Example Code for micro:bit-MakeCode-Light and Temperature Monitor (Basic Tutorial)
This tutorial provides a practical guide to creating a light and temperature monitor using a micro:bit board and IoT expansion board, including hardware setup, software tools, and sample code for displaying real-time data on an OLED screen. Ideal for beginners interested in IoT and microcontroller projects.
Hardware Preparation
- micro:bit board: Quantity 1
- Micro: IoT expansion board: 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.
Sample Code
makecode programs: light and temperature monitor

Result
OLED displays the current temperature and light in real-time.
Was this article helpful?
