Skip to content

serialEvent() description update. #951

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

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Language/Functions/Communication/Serial/serialEvent.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ title: serialEvent()
[float]
=== Description
Called at the end of link:../../../../structure/sketch/loop[`loop()`] when data is available. Use `Serial.read()` to capture this data.

*Please note:* most modern boards do not support this method. See "Notes and Warnings" further below this article.
[%hardbreaks]


Expand All @@ -27,7 +29,9 @@ void serialEvent() {
//statements
}
----
For boards with additional serial ports (see the list of available serial ports for each board on the link:../../serial[Serial main page]):

The Mega 2560 R3 has additional serial ports which can be accessed by adding the corresponding number at the end of the function.

[source,arduino]
----
void serialEvent1() {
Expand Down Expand Up @@ -63,11 +67,9 @@ Nothing

[float]
=== Notes and Warnings
`serialEvent()` doesn't work on the Leonardo, Micro, or Yún.

`serialEvent()` and `serialEvent1()` don't work on the Arduino SAMD Boards
Please note that `serialEvent()` *does not work* on any modern Arduino boards. The only recognized boards to have support as of 2023/12/06 is the *UNO R3* and *Mega 2560 R3*, which are based on the ATmega328P and ATmega2560 chips.

`serialEvent()`, `serialEvent1()`, `serialEvent2()`, and `serialEvent3()` don't work on the Arduino Due.
Instead, you can use the link:../available[`available()`] method. Examples in this page demonstrates how to read serial data only when it is available, which is exactly what `Serial.event()` does.
[%hardbreaks]

--
Expand Down