Skip to content

Instantly share code, notes, and snippets.

@keithweaver
Created April 4, 2017 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keithweaver/61fd7cec7b161a4f500ac05d257c7b72 to your computer and use it in GitHub Desktop.
Save keithweaver/61fd7cec7b161a4f500ac05d257c7b72 to your computer and use it in GitHub Desktop.
Running Motor with Raspberry Pi
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