Last active
December 19, 2016 22:32
-
-
Save hezhao/2a0ec547ded24b31828f9c1b91306e39 to your computer and use it in GitHub Desktop.
Linear Actuator Motor Control
This file contains 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 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