Skip to content

Instantly share code, notes, and snippets.

@hezhao hezhao/linear_actuator.py
Last active Dec 19, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.