Reputation: 343
I m trying to receive a byte from Atmega2560 at an unexpected time ( using USART ) on my pc. So how do I ensure that i don't miss the byte in my python code ( which has may functions running)
Upvotes: -1
Views: 58
Reputation: 87486
You didn't say what operating system you are using or how the ATmega2560 is connected to the computer, but the drivers in your operating system responsible for receiving the serial data from the ATmega2560 will almost certainly have a buffer for holding incoming bytes, so you don't need to worry about constantly reading from the serial port in your Python program. Just read when you get around to it, and the byte should be waiting for you in the buffer.
It's easy to test that this is the case: send a byte from the AVR, purposely wait a few seconds, then read the byte and make sure it was received correctly.
Upvotes: 1