Created
September 21, 2017 09:58
-
-
Save simform-solutions/dc1e6beec02303d8f36541a340485f57 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#rotate servo motor according to transaction | |
def rotate_motor(): | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setwarnings(False) | |
GPIO.setup(25, GPIO.OUT) | |
pwm=GPIO.PWM(25,50) | |
pwm.start(7.5) | |
try: | |
pwm.ChangeDutyCycle(7.5) | |
time.sleep(1) | |
pwm.ChangeDutyCycle(2.5) | |
time.sleep(1) | |
pwm.ChangeDutyCycle(12.5) | |
time.sleep(1) | |
pwm.ChangeDutyCycle(0) | |
time.sleep(1) | |
pwm.stop() | |
except KeyboardInterrupt: | |
pwm.stop() | |
finally: | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment