Example Code for micro:bit-Open Car Light

Last revision 2026/01/14

This article provides a comprehensive guide on how to program car lights using a micro:bit and MakeCode. It includes hardware and software requirements, a wiring diagram, and step-by-step instructions on loading necessary libraries and executing sample code to make the car lights blink.

Hardware Preparation

  • Maqueen Lite x1
  • micro:bit V1/V2 x1
  • MicroUSB cable x1

Software Preparation

  • Programming Platform: makecode
  • Libraries: maqueen, neopixel

Wiring Diagram

No additional wiring is required except inserting the micro:bit into Maqueen Lite.

Other Preparation Work

  1. Load MakeCode Graphical Library for Maqueen:
    • Click the link: Microsoft MakeCode for micro:bit (microbit.org), enter the MakeCode graphical online programming platform.
    • Click "New Project" on the platform to create a new project.
    • Name the project as you want, for example, name it "maqueen1" and click "Create" to confirm.
    • Click the Settings icon in the upper right corner and click "Extensions" in the drop-down menu.
    • Search the MakeCode Extensions for "dfrobot" and select "maqueen".
    • Load neopixel library in the MakeCode Extensions by the same way.

Sample Code

Code Idea: turn on the left and right car lights, then turn off them after waiting for 1s, and repeat it.

Code URL: https://makecode.microbit.org/_YsgWhr2LaDcj

Code File: maqueen1.hex

Code Screenshot:

Result

The 2 red car LEDs of Maqueen begin to blink at 1-second intervals.

Was this article helpful?

TOP