Created
April 4, 2017 04:41
-
-
Save keithweaver/61fd7cec7b161a4f500ac05d257c7b72 to your computer and use it in GitHub Desktop.
Running Motor with Raspberry Pi
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
import RPi.GPIO as GPIO | |
from time import sleep | |
GPIO.setmode(GPIO.BOARD) | |
Motor1A = 16 | |
Motor1B = 18 | |
Motor1E = 22 | |
GPIO.setup(Motor1A,GPIO.OUT) | |
GPIO.setup(Motor1B,GPIO.OUT) | |
GPIO.setup(Motor1E,GPIO.OUT) | |
print "Turning motor on" | |
i = 0 | |
while (i < 1000): | |
GPIO.output(Motor1A,GPIO.HIGH) | |
GPIO.output(Motor1B,GPIO.LOW) | |
GPIO.output(Motor1E,GPIO.HIGH) | |
i += 1 | |
sleep(5) | |
print "Stopping motor" | |
GPIO.output(Motor1E,GPIO.LOW) | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment