I am hoping to control a WINDYNATION 4" Stroke Length Linear Actuator with a Raspberry Pi for a senior design group project. Ideally, the program will make the actuator fully extend, and then retract to a very specific variable length to stretch a tissue sample. This is a copy of my current python program, which the actuator responds to, but it still won't both extend the actuator then retract for the variable amount of time in the same run of the program.
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(motorB, GPIO.OUT) GPIO.setup(motor1E, GPIO.OUT) print("turning motor on") GPIO.output(motor1A, GPIO.HIGH) GPIO.output(motor1B, GPIO.LOW) GPIO.output(motor1E, GPIO.HIGH) sleep(10.16) ratio = input("Enter desired stretch ratio (decimal)") length = input("Enter sample length (mm)") variable = (((ratio))*((length))*.01) print("begin tissue stretch") GPIO.output(motor1A, GPIO.LOW) GPIO.output(motor1B, GPIO.HIGH) GPIO.output(motor1E, GPIO.HIGH) sleep(variable) print("end of tissue stretch") GPIO.output(motor1E, GPIO.LOW) GPIO.cleanup()
Any help anyone might have would be greatly appreciated (for example, a way of programming the actuator based on its inherent orientation, rather than just specific increments of time.