Example Code for MakeCode-Temperature and Brightness Remote Monitor(Based on Easy IoT)
Use the micro:bit onboard temperature and light sensors to monitor environment. The WiFi IoT Module, micro:bit and Easy IoT server will be used for data exchange to realize remote monitoring of temperature and brightness based on IoT.
Hardware Preparation
- MBT0039 micro:bit board x 1
- MBT0008 IO Extender for micro:bit x1
- WiFi IoT module x1
- Wires
Wiring Diagram

Software Preparation
This section mainly introduces how to use the WiFi IoT module and how to program it using MakeCode.
MakeCode Programming Platform:
https://makecode.microbit.org/
I2C Library:
MakeCode I2C Library – DFRobot WiFi IoT
Sample Code
Program Link
https://makecode.microbit.org/_Pow1b0MKRVsm
**Program Blocks **

Result
Send data from IoT platform to micro:bit via WiFi module. When micro:bit received data "L",
the micro:bit board displays the current brightness and upload it to the IoT platform; When the received data is "T", display the current temperature and upload it to the IoT platform. Refresh the page to view the uploaded messages.


Was this article helpful?
