Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking data before reading (non-blocking) #52

Open
TelegramXPlus opened this issue Apr 8, 2024 · 3 comments
Open

Checking data before reading (non-blocking) #52

TelegramXPlus opened this issue Apr 8, 2024 · 3 comments

Comments

@TelegramXPlus
Copy link

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

@euantorano
Copy link
Owner

euantorano commented Apr 8, 2024 via email

@TelegramXPlus
Copy link
Author

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.

@TelegramXPlus
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants