'''
example name：180° servo
version：v1.0
date：2020.3
Author：01Studio
Description: Servo turn to different angles by programming.
Forum: forum.01studio.org
'''

from gpiozero import AngularServo
from time import sleep

#creat SG90 180' Servo object
servo = AngularServo(20, min_angle=-90, max_angle=90,min_pulse_width=0.0005, max_pulse_width=0.0025)

while True:

    #Go to different angle
    servo.angle = -90
    sleep(1)

    servo.angle = -45
    sleep(1)

    servo.angle = 0
    sleep(1)

    servo.angle = 45
    sleep(1)

    servo.angle = 90
    sleep(1)
