Example Code for micro:bit-Driving Servo
- Learning Target: Driving servo. - Effect: The servo repeatedly rotates from 0 to 150 degrees.
Hardware Preparation
- Maqueen Lite-micro:bit Educational Programming Robot Platform x 1 (ROB0148)
- micro:bit board x 1
- Servo Motor x 1 (compatible with Maqueen's servo interface)
Software Preparation
- Makecode graphical online programming platform: makecode.microbit.org
- Maqueen library: Search for "dfrobot" in makecode extension and select "maqueen".
Wiring Diagram
Connect the servo motor to Maqueen's servo interface (S1 or S2).
Other Preparation Work
Ensure the servo motor is compatible with Maqueen's voltage (3.5V-5V).
Sample Code
Screenshot of Makecode Graphical Program:
Makecode program link: https://makecode.microbit.org/_5Te7D33q3UoL
Result
The expected effect is the servo rotating between 0 and 150 degrees.
Additional Information

Was this article helpful?
