You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
562 B

import serial
import time
arduino = serial.Serial('/dev/ttyACM0', 115200, timeout=.1)
def move(locations):
reps = 0
for i in range(0,len(locations),2):
while(arduino.read() != "1"):
arduino.write(locations[i])
time.sleep(0.25)
arduino.flushInput()
arduino.flushOutput()
while(arduino.read() != '1'):
arduino.write(locations[i+1])
time.sleep(0.25)
arduino.flushInput()
arduino.flushOutput()
arduino.write('-')
move(['1','3','2','1','3','2'])