Skip to content

Instantly share code, notes, and snippets.

@hezhao
Last active December 19, 2016 22:32
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 hezhao/2a0ec547ded24b31828f9c1b91306e39 to your computer and use it in GitHub Desktop.
Save hezhao/2a0ec547ded24b31828f9c1b91306e39 to your computer and use it in GitHub Desktop.
Linear Actuator Motor Control
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(8, GPIO.OUT, initial=GPIO.HIGH)
GPIO.setup(10, GPIO.OUT, initial=GPIO.HIGH)
while (True):
response = raw_input('Direction: [U/d] ')
if response.lower() == 'u' or response == '':
GPIO.output(8, GPIO.LOW)
time.sleep(6)
GPIO.output([8, 10], GPIO.HIGH)
elif response.lower() == 'd':
GPIO.output(10, GPIO.LOW)
time.sleep(6)
GPIO.output([8, 10], GPIO.HIGH)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment