I went for:
- Button A in combination with moving the micro:bit left or right, moves 'Car' forwards or backwards;
- Button B in combination with moving the micro:bit rotated forward or backwards, turns the 'Car' left or right;
Perhaps not the most logical combination but fun.
Figure 1: CBiS micro:bit car and 'controller' micro:bit |
The inspiration from this remote car idea came from four sources
- CBiS Education site and seeing them demonstrating it;
- Technology with Save Us Micro:bot Radio Control website ;
- DrBadgr blog on the Lunch Box robot;
- A twitter conversation
— Lorraine Underwood (@LMcUnderwood) May 1, 2017
The approach taken is simple; the Controller micro:bit has the following operations (see Figure 2 for the PXT code)
- Buttons A+B together send '0' out by a radio protocol;
- Button A with changes in the x-direction send '1' or '2';
- Button B with changes in the y-direction send '3' or '4' ;
Figure 2: Remote Control |
The control on the 'Car' turns the received numbers (sent from the controller) into forward, backward, turning motions and stop. The PXT code can be found at Motor Control.
Figure 3: Car Control |
The control is basic but fun (well I enjoyed it). There is a lot of scope for improvement and adaption. Please feel free to adapt any of the code and it would be great to hear what others do via the comments.
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon