Wait on Arduino auto-reset using pySerial
I'm trying to read lines from an Arduino board with a very simple code (for the sake of showcasing the problem) on Linux. Python code: # arduino.py import serial arduino = serial.Serial('/dev/ttyACM0') with arduino: while True: print(arduino.readline()) Arduino code: // simpleWrite.ino long ii = 0; void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); } void loop() { Serial.println(ii); ii++; } As the board auto-resets when the serial connection is opened, the first bytes are likely garbage. After a second or two everything works fine. This is a typical output: $