// Fade the robot LED between three colors in a loop private void runColorMacro() { if (mRobot == null) return; setRobotToDefaultState(); MacroObject macro = new MacroObject(); // Loop as many times as the loop seekbar value macro.addCommand(new LoopStart(mLoopsSeekBar.getProgress())); // Fade to cyan. Duration of the fade is set to the value of the delay seekbar macro.addCommand(new Fade(0, 255, 255, mDelaySeekBar.getProgress())); // Set a delay so that the next command isn't processed until the previous one is done macro.addCommand(new Delay(mDelaySeekBar.getProgress())); // Fade to magenta. Duration of the fade is set to the value of the delay seekbar macro.addCommand(new Fade(255, 0, 255, mDelaySeekBar.getProgress())); // Set a delay so that the next command isn't processed until the previous one is done macro.addCommand(new Delay(mDelaySeekBar.getProgress())); // Fade to yellow. Duration of the fade is set to the value of the delay seekbar macro.addCommand(new Fade(255, 255, 0, mDelaySeekBar.getProgress())); // Set a delay so that the next command isn't processed until the previous one is done macro.addCommand(new Delay(mDelaySeekBar.getProgress())); // End the current loop and go back to LoopStart if more iterations expected macro.addCommand(new LoopEnd()); // Send the macro to the robot and play macro.setMode(MacroObject.MacroObjectMode.Normal); mRobot.playMacro(macro); }