Example Code for micro:bit-GamePad Remote-Controlled Maqueen (Analog Quantity)
Last revision 2026/01/18
In this example, we use rocker analog quantity to control both the moving direction and speed of the car. The more you move the rocker, the faster the speed. The left and right keys (F and D) can be used to control the 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 and speed of the robot car usign analog stick, press F key to light up the left light and D to light up the right.
Code URL: https://makecode.microbit.org/_KLDU7p4ar7FL
Code File: maqueen13-1.hex
Code Screenshot:

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

Result
The more you move the rocker, the faster the speed of the car.
| 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 |
Was this article helpful?
