With the Feedback 360° servos, scripts can control the speed of each wheel from a full speed of 2 turns/second forward to 2 turns/second backward.
After adding the feedback360 module to the micro:bit filesystem and importing it, the drive.speed method takes left and right wheel speeds in terms of 64ths of a turn/second. Positive values are for forward, and negative values are for reverse.
Maneuver Script
Let’s first repeat the familiar forward, backward, left, right script using Feedback 360° speed control. We’ll use a half speed of 64, which is about the same as the continuous rotation servo’s top speed of 130. Unlike the continuous rotation servos, the Feedback 360° servos should not need any left/right speed value adjustments to straighten out the cyber:bot’s forward/backward travel.
- Add five AA batteries to your cyber:bot robot’s battery pack, and plug the battery pack’s barrel plug into the cyber:bot board’s barrel jack.
- Connect the micro:bit in the cyber:bot to your computer with a USB cable.
- Set the PWR switch to 1.
- Right-click the link below for speeds_forward_left_right_backward.hex, and select Save link as…
speeds_forward_left_right_backward.hex
- Open it with the python.microbit.org/v/2 editor.
- Click Connect.
- Click Flash.
- Set the PWR switch to 0.
Maneuver Tests
- Disconnect the cyber:bot’s micro:bit from the USB cable.
- Set it on the floor
- Set the PWR switch to 2.
- Verify that the cyber:bot:
- Rolls forward for 2 seconds
- Rotates left for 1 second
- Rotates right for 1 second
- Rolls backward for 2 seconds