[Boson for micro:bit] Automatic Door 07
userhead
LiLy Nov 09.2021
projectImage
projectImage
projectImage
projectImage
projectImage

STEP1: Connect push-button module to pin P0 of the expansion board; connect servo to P1.

projectImage
projectImage
projectImage

STEP2: Programming

1.    Drag “set pin P9 servo to…degree” block in “actuator” module. Change P9 to P0. Set pin P0 to control servo’ s value.

projectImage

2.    Set: if the button is pressed, the servo rotates for 100 degree and the LED display “o”. Otherwise, the servo rotates for 0 degree and the LED display “×”. Here we need to use “if…then…else” statement.

projectImage

3.    Run the program

projectImage
projectImage
projectImage
projectImage

STEP1: Connect the servo to pin P1; connect the motion sensor to pin P0.

projectImage

STEP2: Programming

1.    Read the digital pin P0 to get the digital signal data of the motion sensor.

projectImage

2.    When the motion sensor detected that there is people passing by, the servo rotates for 100 degrees; otherwise, it rotates 0 degree. We need “if…then…else” statement here.

projectImage

3.    Run the program:

projectImage
projectImage
projectImage

Previous chapter: Electronic Candle 06                                                 Next chapter: Music Box 08                                                      
 

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]]