![Elecrow Crowtail Starter Kit Скачать руководство пользователя страница 31](http://html1.mh-extra.com/html/elecrow/crowtail-starter-kit/crowtail-starter-kit_user-manual_2378765031.webp)
Programming and note
Servo write:
Use this
servo write
block to write a value to the servo on the specified pin
and control the shaft. This function will move the shaft of a standard servo(Crowtail-9G
Servo) to the specified angle, or set the speed of a continuous rotation servo (0 specifies full
speed in one direction, 180 specifies full speed in the other, and approximately 90 specifies
no movement). In this case, we will move the servo’s shaft to 180 degrees and 0 degrees
these two specified angles.
Pause:
After we moved the servo's shaft to 180 degrees (opening the door), we used a
"pause" block to pause the code so that the door would not close immediately and there
was enough time to enter or exit the door.
Download the program to micro:bit to see what happens.
Press the touch sensor, the shaft of the servo will move to 180 degrees. After
two seconds, if the touch sensor is not touched, the servo’ s shaft will move
back to 0 degrees.
Result
How to make automatic doors smarter? When we stand in front of the door, how do
we make it open automatically without any keys or switches?
28