Code Example for micro:bit-Smart Streetlights

After connecting the modules according to the connection diagram below, the setup works in this way: the streetlight will light up only when having detected there are passersby at night. This design greatly saves power resources.

Hardware Preparation

BOS0004 Light Sensor BOS0009 Sound Sensor BOS0017 LED Module
MBT0039 Micro:bit BOS0040 Micro:bit BOSON Expansion Board

Software Preparation

Mind+ and makecode graphical programming tools.

Wiring Diagram

Sample Code

Mind+ Sample Program:

Result

After connecting the modules according to the connection diagram below, the setup works in this way: the streetlight will light up only when having detected there are passersby at night. This design greatly saves power resources.

Additional Information

Flow Chart:

Was this article helpful?

TOP