I am trying to send a command to my arduino (leonardo) and retrieve the output.
I set the parameters to
stty -F /dev/ttyACM0 cs8 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts
If i echo a command, i can get the output via cat but this had to be in a different terminal :~
So, it don't work with this script
#!/bin/bash
cat /dev/ttyACM0 | head -n 1 (tried with & too)
echo "amr" > /dev/ttyACM0
also i can't get anything with tail -f (Arch Linux)
What could be wrong ?
Thanks
#! /usr/bin/env python
import time
import serial
ser = serial.Serial('/dev/ttyACM0', 115200, timeout=3)
ser.write("amr\n".encode("utf-8"))
line = ser.readline().decode("utf-8")
print(line)
ser.close()
quit()
I'am not sure either, i'am new to arduino
Seem like Leonardo don't auto-reset.
I have an instant respond with that script but i'd be glad to find other pyserial example.