Example Code for micro:bit-Sound-controlled Maqueen

This article showcases example code for using micro:bit to control Maqueen's RGB LED through sound, detailing hardware and software setup, coding instructions, and the resulting interactive LED color changes and pattern displays.

Hardware Preparation

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 as described in the previous example.
  2. Use a micro:bit V2.0 or later.

Sample Code

Effect: clap hands to command RGB LED on the bottom of Maqueen car, clap hands once to change a color and the micro:bit LED matrix displays a different pattern.

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

Code File: maqueen11.hex

Code Screenshot:

Result

clap hands in proper order to make the bottom RGB LED show red, orange, yellow, green, blue, purple and white colors, and the LED matrix display different patterns successively.

Was this article helpful?

TOP