Receiver Full Tilt Control & Stop Range
In addition to displaying the diamond when the y-axis tilt is close to level, the radio_tilt_bot_fb_with_stop_range project also makes the cyber:bot stay still.
Example project: radio_tilt_bot_fb_with_stop_range
- If you are in a classroom, adjust the radio set group in the project to your assigned channel.
- Make sure the PWR switch is set to 1 first.
- Enter and flash radio_tilt_bot_fb_with_stop_range into the micro:bit that’s in the receiver cyber:bot.
- Tilt the micro:bit transmitter and verify that the receiver cyber:bot displays a copy of the needle.
- Hold the micro:bit tilt transmitter level, with the LEDs upward and the USB connector pointing toward you.
- Verify that both the transmitter and receiver micro:bits display a diamond.
- Set the cyber:bot board PWR switch to 2.
While still holding the transmitter micro:bit level, does the cyber:bot stay still?
As you tilt the tilt transmitter away from and then toward you, does it make the cyber:bot roll forward and backward?
- Set the PWR switch back to 1.
How It Works
Here is the portion of radio_tilt_bot_fb_with_stop_range that’s different from the previous radio_tilt_bot_fb_only that it’s based on.
Keep in mind that fb is y / 8, so instead of looking for y being outside the +/- 80 range, this program checks if fb is outside the +/- 8 range. When the absolute value of fb is greater than 8, the project displays the tilt needle and sets the vL and vR variables just like it did in the previous radio_tilt_bot_fb_only project. But when fb falls inside the -8 to 8 range, it displays the diamond and sets vL and vR to 0. Whenever the else block sets vL and vR to zero, it makes the servos stop spinning.