Elecrow on-line store, make your making easier.
https://www.elecrow.com/
Material:
Micro:bit
x1
Crowtail- Base Shield for Micro:bit
x1
Crowtail- MOSFET
x1
LED
x1
Lesson13.Obstacle Detection
Smart car is the most common application in DIY, obstacle avoidance is the basic function,
this lesson will teach you how to use IR reflective sensor to detect obstacle. Connect the Crowtail
IR reflective sensor to P0 interface and connect the crowtail- buzzer to P1 interface. Upload the
code , when the sensor detect the obstacle, the buzzer will make a noise.
Note: The detection distance is 4-15 mm.
basic
.
forever
(() => {
pins
.
digitalWritePin
(DigitalPin.P0,
1
)
basic
.
pause
(
500
)
pins
.
digitalWritePin
(DigitalPin.P0,
0
)
basic
.
pause
(
500
)
})