Elecrow on-line store, make your making easier.
https://www.elecrow.com/
Material:
Micro:bit
x1
Crowtail- Base Shield for Micro:bit
x1
Crowtail- Sound sensor
x1
Crowtail- LED
x1
Lesson9.Breathing LED
Control the LED with different frequency PWM wave, in the lesson we use a loner
potentiometer to adjust the PWM frequency, the LED will light brighter and brighter,then light
darker and darker, which is like breathing . Connect the crowtail- LED to P0 interface and connect
the crowtial- liner potentiometer to P1 interface, upload the code into micro:bit, then slide the
line potentiometer and observe the LED.
let
reading =
0
basic
.
forever
(() => {
reading =
pins
.
digitalReadPin
(DigitalPin.P0)
if
(reading) {
pins
.
digitalWritePin
(DigitalPin.P2,
1
)
basic
.
pause
(
2000
)
pins
.
digitalWritePin
(DigitalPin.P2,
0
)
}
})