Microbit- Remote Servo
Editor: MakeCode https://makecode.microbit.org/
Hardware: Kitronik(UK)
https://kitronik.co.uk/collections/microbit-and-accessories
Parts:
· Microbit Starter Kit BBC micro:bit V2 - Kitronik Starter Kit x2
· Kitronik Robotics Board
· 4x “AA” 6V Battery Pack
· 4 “AA” Batteries
· Servomotor
Description of Code:
On Start block sets the radio group. Both Transmitter and Receiver need to be on the same group.
In the Variables palette, a variable ‘angle’ is created for use by the transmitter, and a variable ‘angle2’ for use by the receiver to hold the received value.
To use the Servo function with the Kitronik Robotics board, we need to add the ‘Kitronik Robotics Board’ extension to MakeCode
The tilt sensors give readings from -1053 to +1053, so the map function(in the Math menu) changes this to 0 to 180 for the servo
The receiver block sets angle 2 to the received number