Example Code for micro:bit-MakeCode-Remote controlled RGB LEDs

Explore how to use a micro:bit and Easy IoT platform to control RGB LEDs remotely, including step-by-step hardware and software preparations, wiring instructions, and sample code for creating interactive lighting effects that sync with music.

Hardware Preparation

  • micro:bit board: Quantity 1
  • Micro: IoT expansion board: Quantity 1
  • DFRobot Easy IoT platform access: Quantity 1

Software Preparation

Wiring Diagram

Plug the micro:bit board into the Micro: IoT expansion board.

Other Preparation Work

  1. Open the Easy IoT website:http://iot.dfrobot.com.cn/
  2. Sign up/Sign in to Easy IoT.
  3. Add a new device to match your micro:bit, get the device topic.

Sample Code

Result

Send a command "L" via Easy IoT, to dispaly an effect of water lamp (alternatively emit red and purple). When the module receives the command "B", it will play the music "twinkle, twinkle, little start" and the RGB shines with the music.

Was this article helpful?

TOP