The plan: connect servo to raspberry pi, run code to simulate a waving hand, connect to website so people can run the code.
Code(3-21-19):
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(3,GPIO.OUT)
p=GPIO.PWM(3,50)
p.start(7.5)
try:
while True:
p.ChangeDutyCycle(7.5)
time.sleep(1)
p.ChangeDutyCycle(12.5)
time.sleep(1)
p.ChangeDutyCycle(2.5)
time.sleep(1)
except KeyboardInterrupt:
GPIO.cleanup()
No comments:
Post a Comment