VMM502
V. 01 – 17/01/2019
14
©Velleman nv
Now, drag and drop the block
toggle LED at pin
P0 Off
next the
then
logic. Set pin
P0
to
P1
and set
Off
to
ON
.
Finally, drag and drop the block
toggle LED at pin
P0 Off
next to the
else
logic. Set pin
P0
to
P1
.
If motion is detected by the PIR sensor, the light is triggered (the LED will light). Else, the light is
turned off.
When complete, we compile the programme to generate a .hex file. Click on the download button and
save the .hex file to the
Downloads
folder (C:\downloads). This .hex file is ready to be uploaded to the
micro:bit.
Plug the micro:bit into the USB port via the micro-USB cable. Then, drag and drop the .hex-file (from
the
Downloads
folder) onto the micro:bit
Removable device
to upload the programme.
Voilà! You have created a simple smart light. Walk into the room and let it light!
8.3
Project 3 – Simple Alarm Box
Sound the alarm box!
1
micro-USB cable
4
BoB
2
micro:bit
5
LED
3
crash sensor
6
OLED
What do I need?
1x micro:bit
1x micro-USB cable
1x BoB
1x crash sensor
1x OLED
1x LED
2x female-female jumper wires