-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
I recently fell into the serialEvent() hole - the reference doc says: "Called when data is available. Use Serial.read() to capture this data."
The language here seems to suggest this is a callback - i.e. the function will be asynchronously called when data is available. Looking at the code, it is only called at the end of the loop on serialEventRun. This is dissimilar to a callback, because I was expecting it to be called even when in a while(true) loop in another function (as per what the doc suggests). The request here is to update the reference doc for serialEvent() so that others don't fall into the same hole and think it is actually a callback rather than a posthook function for loop().
Out of curiosity, what is the difference between serialEventRun and Serial.available() - is serialEventRun checkable within a sketch?