User Manual
15 16
Project 6 : Smart Guard
Diculty Level
Part List
Description
6. Smart Guard
The ultrasonic ranger is able to detect
distance. In this demo, we will use the
ultrasonic ranger to detect if the is too
close. If something is too close the micro:bit
will show a sad face on it.
Note: This project requires high input
voltage, please use the Grove Shield for
micro:bit to power the circuit.
1x Grove - Ultrasonic Ranger
1x Grove Shield for micro:bit
1x micro:bit
Steps
Add basic block forever, then add logic block
if…then…else…
2. For condition ‘if’, add logic block 0≥0
5. For “else”, add basic block show icon, choose the
‘sad face’ icon.
6. Add basic blocks pause (ms) (100).
7. Hardware connection. Connect the Grove – Ultrasonic Sensor to P0 port of Grove shield for micro:bit.
8. Click Download to transfer your code in your micro:bit.
9. Move your hand up and down in front of the Ultrasonic Sensor, when your hand is less than 10cm close to the sensor, the micro:bit will
show sad face.
Try to change the warning distance or the warning icon. You may also place
this smart guardian on your favorite toy to protect it! protect it.
3. If you have added the Grove Package successful-
ly, replace the left ‘0’ with Grove block Ultrasonic
Sensor (in cm) at P0. Change another “0” to “10”.
4. For ‘then’, add basic block show icon, choose the
‘happy face’ icon.
1
1
4
4
2
2
3
3
5
5
6
6
2
1
1
2
3
3
P0/P14