Created
December 22, 2021 23:17
-
-
Save duffyd/7058340241c425050aaab6cd4f7e7b67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
import time | |
servoPIN = 12 | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(servoPIN, GPIO.OUT) | |
p = GPIO.PWM(servoPIN, 50) | |
p.start(5) # Initialization | |
try: | |
while True: | |
p.ChangeDutyCycle(2.5) | |
time.sleep(5) | |
p.ChangeDutyCycle(11.5) | |
time.sleep(5) | |
p.ChangeDutyCycle(20.5) | |
time.sleep(5) | |
p.ChangeDutyCycle(11.5) | |
except KeyboardInterrupt: | |
p.stop() | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment