Example Code for micro:bit-Nightlight (Programming)

Install some color night lights in the garden. At night, when the motion sensor detects someone passing by, the lights light up; when no one detected, the lights go out to save power.

Hardware Preparation

BOS0019 Multicolor String Light BOS0004 Light Sensor BOS0013 Motion Sensor
micro:bit microbit expansion board
MBT0039 micro:bit BOS0040 micro:bit BOSON Expansion Board

Software Preparation

  • Mind+
  • MakeCode

Wiring Diagram

Connection Diagram:

Result

Video Demo

Programming

Additional Information

Program Flowchart:

Was this article helpful?

TOP