Hi,
How can I check if there was no serial input after certain time period like 10s?
Thank you!
Hi,
How can I check if there was no serial input after certain time period like 10s?
Thank you!
Save the value of millis() every time a message is received. Something like
lastTimeMessageReceived = millis();
Then you can check for a timeout with code like this
if (millis() - lastTimeMessageReceived >= 10000) {
 // there have been no messages for 10 seconds
}
...R
Robin2:
Save the value of millis() every time a message is received. Something likelastTimeMessageReceived = millis();
Then you can check for a timeout with code like this
if (millis() - lastTimeMessageReceived >= 10000) {
// there have been no messages for 10 seconds
}
...R
Thank you, I did it with similar approach with combination of Boolean.