User Manual

23 24
Project 10 : Guardians of The Secrets in Your Bag
Diculty Level
Part List
Description
10. Guardians of The Secrets
in Your Bag
In this demo, you will make a guardian
to guard your secret stuff. If anyone
opens the box, the guardian will flash a
red light and sound an alarm!
1x Grove - Speaker
1x Grove - Light Sensor
1x Grove - Red LED
1x Grove Shield for micro:bit
1x micro:bit
1
2
3
4
5
Steps
1. In the basic block forever, set a variable named 'Light
Value' to analog read pin P1.
2. Now we add a logic block if...then..else, in this block we
set the condition as if the 'Light Value' is greater than '100'
5. Add basic block pause (ms) (100).
6. Hardware connection: Connect the speaker to P0 port,
Grove – light sensor to P1 port, Grove - Led to P2 port,
7. Click Download to transfer your code in your micro:bit!
8. Open and close your secret box to see how it works.
Try to use this creation to protect
your secrets in the drawer.
When the condition is triggered, we set the speaker to
continuously playing tone High C on P2(Pin2).
4. For else’, add 2 pin blocks digital write pin and set pins to
‘0’. This will turn off the Led and speaker when the box is
closed and no light is deteced.
1
1
4
4
5
5
2
2
3
3
4
2
1
3
5
P0/P14
P1/P15
P2/P16