Thursday, March 21, 2019

Adam-PM-40min-Waving Hand

Today I started a new project: the Waving Hand.

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