You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to combine serial.nim and Arduino for a project of mine yet the line
port.readLine() is blocking and unless I create a second thread for handling other things the code does not work (it just waits for data). I would like to have something like Arduino Serial.available() or python ser.in_waiting so that I don't have to split the code into multiple threads
The text was updated successfully, but these errors were encountered:
Hi,
Yes the serial port methods are all blocking. There isn’t currently a way to get the amount of available data. I’d be open to adding one so long as there is a way to do so on all of the supported platforms.
However, it may be worth trying the AsyncSerialPort. It’s read function returns a future which you could use to read asynchronously which may be one option.
Alright, thank for the suggestion. I'll see the async version but I think that for now I will use two separate threads for reading and writing data using serial (not very safe, but it does the job). Thanks again.
Alright, thank for the suggestion. I'll see the async version but I think that for now I will use two separate threads for reading and writing data using serial (not very safe, but it does the job). Thanks again.
I might also use a lock system to be safe and to keep the code as simple as possible.
I would like to combine serial.nim and Arduino for a project of mine yet the line
port.readLine()
is blocking and unless I create a second thread for handling other things the code does not work (it just waits for data). I would like to have something like ArduinoSerial.available()
or pythonser.in_waiting
so that I don't have to split the code into multiple threadsThe text was updated successfully, but these errors were encountered: