Forward and Backward
Have you ever thought about what direction a car’s wheels have to turn to propel it forward? The wheels turn in opposite directions on opposite sides of the car. Likewise, to make the cyber:bot go forward, its left wheel has to turn counterclockwise, while its right wheel turns clockwise.
Remember that a project can use the servo speed Block to control the speed and direction of each servo. Then, it can use the pause block to keep the servos running for certain amounts of time before choosing new speeds and directions. Here’s an example that will make the cyber:bot roll forward for about three seconds, and then stop.
Hardware Setup
- Set the cyber:bot board’s power (PWR) switch to Position 0.
- Make sure the battery holder is loaded with 5 AA batteries.
- Make sure the battery holder’s barrel plug is firmly plugged into the cyber:bot board’s barrel jack.
- Connect your micro:bit module to your computer with a USB cable.
Example Project: forward_three_seconds
- In a Google Chrome or Microsoft Edge browser, go to makecode.microbit.org
- Open a new project and name it forward_three_seconds.
- Make sure the cyberbot Extension is included in your new project.
(See Add modules to your micro:bit). - Make sure your micro:bit is properly connected and paired.
- Enter the blocks and arguments below and click the purple Download button in the bottom left.
- Set the power (PWR) switch to position 2.
- Verify that the cyber:bot rolls forward for three seconds.
- Set the PWR switch to 0.
Your Turn – Traveling Backwards
Now, let’s try making the cyber:bot travel backwards for three seconds.
- Change the project name from forward_three_seconds to backward_three_seconds, or make a new one.
- Change the servo speed arguments so the cyber:bot will travel backwards for three seconds.
- Flash it with the Download button.
- Set the PWR switch to 2.
- Verify that the cyber:bot rolls backward for 3 seconds.
- Set the PWR switch to 0.