Arduino Serial Input


if (condition) {

// statement(s)

}

if: The 'if' statement checks for a condition and executes the proceeding statement or set of statements if the condition is 'true'.

condition: a boolean expression that evaluates to true or false.


Serial.available()

available: Serial port method. Get the number of bytes (characters) available for reading from the serial port. This is data that’s already arrived and stored in the serial receive buffer (which holds 64 bytes).

Return: The number of bytes available to read.


Serial.read()

read: Serial port method. Reads incoming serial data.

Return: The first byte of incoming serial data available (or -1 if no data is available). Data type: int.

Related Topics:

  1. Arduino IDE.

  2. Arduino Blink.

  3. Arduino Serial.