This page is also available in 2 other languages

serialEvent()

Description

Called when data is available. Use Serial.read() to capture this data.

Syntax

void serialEvent() {
  //statements
}

For boards with additional serial ports (see the list of available serial ports for each board on the Serial main page):

void serialEvent1() {
  //statements
}

void serialEvent2() {
  //statements
}

void serialEvent3() {
  //statements
}

Parameters

statements: any valid statements

Returns

Nothing

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

serialEvent(), serialEvent1()``serialEvent2(), and serialEvent3() don’t work on the Arduino Due.

See also