Skip to content
This repository has been archived by the owner on Dec 31, 2019. It is now read-only.

Commit

Permalink
Changed README and code to no longer use the old, deprecated function…
Browse files Browse the repository at this point in the history
…s in favor of the sphere object counterparts.
  • Loading branch information
zenelk committed Nov 16, 2013
1 parent f01dbb9 commit 264b51e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
10 changes: 6 additions & 4 deletions samples/MacroLoader/README.md
Expand Up @@ -32,7 +32,8 @@ http://forum.gosphero.com/showthread...5-Share-Macros
//Set Robot
macro.setRobot(mRobot);
//Send Macro to Sphero
macro.playMacro();
mRobot.executeMacro(macro);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (Exception e) {
Expand All @@ -46,9 +47,10 @@ http://forum.gosphero.com/showthread...5-Share-Macros
When you want to stop a previous played command, its easy to send in an Abort and reset the Sphero's state you want it to continue in. The code is as follows:

AbortMacroCommand.sendCommand(mRobot); // abort command
StabilizationCommand.sendCommand(mRobot, true); // turn on stabilization
RGBLEDOutputCommand.sendCommand(mRobot, 255, 255, 255); // make Sphero White
FrontLEDOutputCommand.sendCommand(mRobot, 0.0f); // Turn off tail light
mRobot.enableStabilization(true); // turn on stabilization
mRobot.setColor(255, 255, 255); // make Sphero White
mRobot.setBackLEDBrightness(0.0f); // Turn off tail light
mRobot.stop(); // Stop rolling

## Chunky Macros vs Normal Macros

Expand Down
Expand Up @@ -101,7 +101,7 @@ public void largeDanceClicked(View v) {
//Set Robot
macro.setRobot(mRobot);
//Send Macro to Sphero
macro.playMacro();
mRobot.executeMacro(macro);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (Exception e) {
Expand All @@ -128,7 +128,7 @@ public void commandClicked(View v) {
//Set Robot
macro.setRobot(mRobot);
//Send Macro to Sphero
macro.playMacro();
mRobot.executeMacro(macro);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (Exception e) {
Expand All @@ -155,7 +155,7 @@ public void strobeClicked(View v) {
//Set Robot
macro.setRobot(mRobot);
//Send Macro to Sphero
macro.playMacro();
mRobot.executeMacro(macro);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (Exception e) {
Expand All @@ -181,7 +181,7 @@ public void smallDanceClicked(View v) {
//Set Robot
macro.setRobot(mRobot);
//Send Macro to Sphero
macro.playMacro();
mRobot.executeMacro(macro);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (Exception e) {
Expand All @@ -203,10 +203,10 @@ public void stopClicked(View v) {
*/
private void returnSpheroToStableState() {
AbortMacroCommand.sendCommand(mRobot); // abort command
StabilizationCommand.sendCommand(mRobot, true); // turn on stabilization
RGBLEDOutputCommand.sendCommand(mRobot, 255, 255, 255); // make Sphero White
BackLEDOutputCommand.sendCommand(mRobot, 0.0f); // Turn off tail light
RollCommand.sendStop(mRobot); // Stop rolling
mRobot.enableStabilization(true); // turn on stabilization
mRobot.setColor(255, 255, 255); // make Sphero White
mRobot.setBackLEDBrightness(0.0f); // Turn off tail light
mRobot.stop(); // Stop rolling
}
}

0 comments on commit 264b51e

Please sign in to comment.