11. Case 09: Automatic Doors¶
11.4. Bricks build-up¶
11.5. Installation Mthods of Hardwares¶
Install the sonar:bit with the bricks.
11.6. Hardware Connection¶
Connect a sonar:bit to P1 and the servo to S0 port on Wukong breakout board.
11.8. Coding¶
Add extensions¶
Click “Advanced” in the MakeCode to see more choices.
Search with Wukong in the dialogue box to download it.
Search with https://github.com/elecfreaks/pxt-sonarbit in the dialogue box to add the sonar:bit extension.
Program¶
Result¶
When the ultrasonic sensor detects someone passing by, it will display √ on the micro:bit and control the servo to open the door and close it automatically after 5 seconds, if the ultrasonic sensor does not detect anyone, it will keep displaying × on the micro:bit and the door is closed.