-
Notifications
You must be signed in to change notification settings - Fork 16
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
Putting sleep_for in a loop with a printf not ending with \n will not execute that printf #214
Comments
Hmm, this has got to be something related to buffering, but I am unsure whether it's in the C library or in BufferedSerial. https://os.mbed.com/forum/bugs-suggestions/topic/1849/ ^ This suggests it's in the C library, it's an old thread but it seems to still be valid. You might try |
Because of the change to other compiler I cannot compile my original project anymore with mbed arm.
|
Tested in new environment with latest ce version of mbed, this is working but I have to do flush.
and
|
Are we good to close this? |
I don't think this is fully solved. Why do you need to flush the buffer before sleep and why this is not done automatically as a safety measure? |
So if you don't disable sleep, the code sample you posted doesn't work? Yes, that does seem suspiciously like a bug. |
Exactly |
Purpose is to write the time and overwrite it at the same line:
But when the ThisThread::sleep_for(5000); is inserted, the printf will never be executed.
If you change \r to \n it works, but then you get a new line on each printf.
The text was updated successfully, but these errors were encountered: