I am writing a program in Python (using PySerial) that needs to read data from the Arduino quickly. For this reason I have set the serial timeout to 0.01 seconds. (Baud rate is 115k) If I don't set the timeout this low I run into issues with there being a noticeable delay between sending a command and receiving a reply. As long as I have the timeout set low enough then its all fine, but the downside is that I have a message print out when I first connect to the Arduino to confirm that it has indeed connected. (Message reads "Connected" once the serial connection has been established in void setup)
Okay, the problem: If I don't have the timeout set to 0.9 seconds or higher, the initial 'connected' message gets cut off. Of course if I have it set that high I get the issues I first described.
I'm looking for a way to keep the timeout very low but also get this first connected message when the void setup runs. Is there a way to have my cake and eat it too?
I did try starting with the timeout set to 1 second and once the connected message prints out change it to 0.01 seconds, but it just kept giving me an error.
Any help would be appreciated.