@Falcounet I am calling macros to rotate motors and control sensors.
the code is something like this:
def send_command_duet(command):
with serial.Serial('/dev/ttyACM0') as ser:
ser.setRTS(True)
ser.write(b'\n')
ser.write(command)
eof = False
while not eof:
line = ser.readline()
if line == b'ok\n':
eof = True
print(line)
while True:
Capture image
classify image
send_command_duet(command) #perform action
receive signal from duet to go to next iteration