Skip to content

[Bug/Update] Update serialEvent() doc #382

@imranmoezkhan

Description

@imranmoezkhan

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions