Example Code for micro:bit-GamePad Remote-Controlled Maqueen (Switch Quantity)
Last revision 2026/01/18
In this example, we set the analog rocker as switch quantity to control the robot car to move forward, move backward, turn left, turn right, and use the left and right keys (F and D keys) to control the the left and right car lights to be on/off.
Hardware Preparation
- Maqueen Lite x1
- micro:bit V1/V2 x1
- MicroUSB cable x1
- GamePad for micro:bit x1 (https://www.dfrobot.com/product-1711.html)
Software Preparation
- Programming Platform: makecode
- Libraries: maqueen, neopixel
Wiring Diagram
No additional wiring is required except inserting the micro:bit into Maqueen Lite and GamePad.
Other Preparation Work
- Load MakeCode Graphical Library for Maqueen as described in the previous example.
- Prepare a GamePad for micro:bit (https://www.dfrobot.com/product-1711.html).
Sample Code
Effect: control the moving direction of the robot car using analog rocker, press F key to light up the left light and D to light up the right.
Code URL for Gamepad: https://makecode.microbit.org/_i1fAXXFhR754
Code File for Gamepad: maqueen12-1.hex
Code Screenshot for Gamepad:

Code URL for Maqueen Lite:https://makecode.microbit.org/_YAjXaY6XARRg
Code File for Maqueen Lite: maqueen12-2.hex
Code Screenshot for Maqueen Lite:

Result
| Gamepad Status | Robot Car Movement Mode |
|---|---|
| Move the rocker upward | Move forward |
| Move the rocker down | Move backward |
| Move the rocker left | Turn left |
| Move the rocker right | Turn right |
| Rocker in middle position | Stop |
| Key F (Blue) | Left light on |
| Key D (Yellow) | Right light on |
Additional Information
The GamePad for micro:bit is as shown in the following figure:

Was this article helpful?
