[Boson for micro:bit] Electronic Candle 06
userhead
LiLy Nov 08.2021
projectImage
projectImage
projectImage
projectImage
projectImage

STEP1: Connect the sound sensor module to the pin P0 of the extension board; LED module to P1.

projectImage

STEP2: Programming

1.     Let’s begin to design our project according to the tips: drag “read analog pin P0” and “display” blocks from the “Micro: bit” module; drag out “if… then…else” block from the “Control” module; drag “<” in the “Operation” module to script area.

projectImage

2.     Read the analog value(0~1023) of “read analog pin P0” that connected with sound sensor to detect the sound of intensity.

3.    Edit the programs to realize “sound intensity detecting”. “<” can be used to judge if the analog value of sound intensity meets the set standard.

AS shown in figure 3.1.4, if the condition “’read analog pin P0’<’80’” is true, also means the sound intensity grade is 1, the on-board LED displays figure “1”.

If the condition is false, the sound intensity grades 2 and the LED displays figure”2”. Add a “wait 1 sec” block under the “...then” to prevent the LED figure from flashing.

projectImage
projectImage
projectImage

Control the LED to turn on/off according to the value of the pin connected to the sound sensor.

projectImage

1.     Drag “set digital pin P0 output” block from “micro: bit” module to script area, and change P0 to P1.

projectImage

2.    Programming to make a “electronic candle”

When the analog value of sound sensor is less than the preset value 80, the LED keeps on, otherwise, blow it like a candle, when the sound intensity is over 80, the LED keeps off for 2 seconds.

projectImage
projectImage

Previous chapter: Electronic Fan 05                                                 Next chapter: Automatic Door 07       

Click to buy

 

License
1
All Rights
Reserved
[[i.text]]
licensBg
0
0
COMMENTS ([[commentTotla]])
[[c.user_name]] [[c.publish_time]]
[[c.parent_comment.count]]