Example Code for micro:bit-Buzzer

Last revision 2025/12/19

This blog post serves as a practical guide for integrating a micro:bit with the Maqueen V5 robot car to play music through a buzzer, including detailed steps for hardware and software preparation and easy-to-understand example code.

Hardware Preparation

  • Maqueen V5 Robot Car: 1 (Purchase Link: https://www.dfrobot.com/product-2937.html)
  • micro:bit Mainboard (V1 or V2): 1
  • 3 AA Batteries: 1 set

Software Preparation

  • MakeCode Platform: https://makecode.microbit.org/
  • Maqueen Library: Load via MakeCode Extensions (search for "dfrobot" and select "Maqueen")

Other Preparation Work

  • Ensure the micro:bit mainboard is properly plugged into Maqueen V5.
  • Install the batteries correctly.
  • Turn on the power switch.
  • If using Microbit V1, ensure the buzzer switch is off to use the P0 port.

Sample Code

Example 1: Play Music

Result

  • The buzzer plays music as programmed.

Was this article helpful?

ON THIS PAGE

TOP