Create a light that will only light up when someone is in the room using a PIR sensor.
1 x Micro:bit 1 x Micro USB Cable 1 x Breakout Board 1 x PIR Sensor 1 x LED
Connect the Micro:bit to the Breakout Board. Then connect the PIR sensor to pin 0 of the Breakout Board and the LED to pin 1 of the Breakout Board, making sure the colours of the wires match the pins on the Breakout Board.
Go to makecode.microbit.org, open up the advanced tab and click on Add Package. Type "tinker kit" into the search box and click on the package shown to add it. You should now see the Tinkercademy and OLED packages.
In the forever block, put the following blocks. The 'If' block checks if the PIR sensor detects any movement and if it does, it turns on the LED.
And Presto! You have your very own smart light! Now you won't have to reach for the switch for light anymore.
Code and References
Completed this tutorial?
Spread the word! Let's get this trending on social media with #letsgethacking #SmartLight