Servo-motor

From aldeid
Jump to navigation Jump to search

Diagram

Raspberrypi-servo-schema.png

Code

from gpiozero import Servo
from time import sleep

servo = Servo(18)

while True:
	servo.mid()
	print("mid")
	sleep(0.5)
	
	servo.min()
	print("min")
	sleep(1)

	servo.mid()
	print("mid")
	sleep(0.5)
	
	servo.max()
	print("max")
	sleep(1)