Example Code for micro:bit-MakeCode-Light and Temperature Monitor (Easy IoT)

The article provides a step-by-step guide for creating a light and temperature monitoring system using a micro:bit and the Easy IoT platform, including hardware and software setup and sample code.

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

Makecode programs: light and temperature monitor

Result

Press down button A, send the current temperature value to the workshop; the first line of the OLED screen displays the temperature value. Press down button B, send the current light value to the workshop; the second line of OLED screen displays the light value.

T for temperature; L for Light

Was this article helpful?

TOP