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
- Makecode online graphical programming platform: https://makecode.microbit.org/
- Micro:IoT library: https://github.com/DFRobot/pxt-microIoT
- How to install an library?
Wiring Diagram
Plug the micro:bit board into the Micro: IoT expansion board.
Other Preparation Work
- Open the Easy IoT website:http://iot.dfrobot.com.cn/
- Sign up/Sign in to Easy IoT.
- 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?
