Aug-08-2020, 08:06 AM
I'm working on a project where I control a LED matrix connected to an Arduino.
Using pyserial I open the Arduino's serial port and send a "?" to it.
The Arduino should reply with an "!", however I'm unable to read this.

I tried adding a time.sleep() before writing and reading to/from the serial port but it did not work either.
Using pyserial I open the Arduino's serial port and send a "?" to it.
The Arduino should reply with an "!", however I'm unable to read this.
import serial port = "/dev/tty.usbserial-A106TL49" port = serial.Serial(port, 115200, timeout=5) port.write("?\n".encode()) port.flush() resp = port.readline().decode() port.close() print(resp)If I copy and paste each line into the Python Shell (or just type it in manually), it works.

I tried adding a time.sleep() before writing and reading to/from the serial port but it did not work either.