Try This: Put it Back
It is often a good idea to put things back where you got them when you are done with them! Let's add a Button A feature to make the cyber:bot take the object and place it back where it started before you pressed Button B.
- Make the one change and add all the lines as shown below.
- Make the same speed adjustments you did in the Tests section to straighten the cyber:bot’s forward and backward travel.
- Save your modified script by changing the Script Name field to cyber_bot_gripper_forward_backward_object and then clicking Load/Save and selecting Download Project Hex.
- Flash the script into the cyber:bot, unplug USB, and set PWR to 2.
- Verify that Button B will make the cyber:bot bring an object forward and Button A will bring it back to the starting point.
Your Turn
Your Gripper-equipped cyber:bot is not limited to forward and backward motion! With some modifications to the script, you can add any of the turns introduced in the Navigation with the cyber:bot chapter’s Left and Right Turns activity.
- Try writing a script where the cyber:bot rolls forward, picks up an object, turns in place by 180°, then rolls forward again to set the object down near where it started.