Elecrow on-line store, make your making easier.
https://www.elecrow.com/
Material:
Micro:bit
x1
Crowtail- Base Shield for Micro:bit
x1
Crowtail- Moisture sensor
x1
Lesson8.Sound Detection
In our daily life, some people like lively, some like quiet , if we use sound reasonably, it will
play a huge role in the field of intelligence, this lesson will teach you detect the sound as a switch
to power on one LED. Connect the Crowtail- Sound sensor to P1 interface and connect one LED to
P2 interface, upload the code, if the sound senor detect some sound , the LED will light on 2
seconds.
let
reading =
0
basic
.
forever
(() => {
reading =
pins
.
analogReadPin
(AnalogPin.P0)
led
.
plotBarGraph
(
reading,
1023
)
if
(
input
.
buttonIsPressed
(Button.A)) {
basic
.
showNumber
(reading)
}
})