Serial.available()
Descripción
Obtiene el número de bytes (caracteres) disponibles para su lectura desde el puerto serie. Se trata de datos que ya llegaron y se almacenaron en el buffer de recepción serie (que tiene 64 bytes).
available() hereda de la clase Stream
Sintaxis
Serial.available()
Solo Arduino Mega:
Serial1.available()
Serial2.available()
Serial3.available()
Parámetros
- Ninguno
Retornos
- El número de bytes disponibles para leer.
Ejemplo
Ejemplo 1
- Type "HELLO" on Serial Monitor and click Send button:
- The result on Serial Monitor:
Ejemplo 2
Ejemplo para Arduino Mega.
※ Nota:
Serial functions are not only used for the communication between an Arduino board and Serial Monitor of Arduino IDE but also used for the communication between:
- An Arduino board and other Arduino board
- An Arduino board and other sensors/devices
- An Arduino board and computer (any Serial software on computer)
Ver También
- Lenguaje: Arduino - Serial
- Lenguaje: Serial.availableForWrite()
- Lenguaje: Serial.begin()
- Lenguaje: Serial.end()
- Lenguaje: Serial.find()
- Lenguaje: Serial.findUntil()
- Lenguaje: Serial.flush()
- Lenguaje: if(Serial)
- Lenguaje: Serial.parseFloat()
- Lenguaje: Serial.parseInt()
- Lenguaje: Serial.peek()
- Lenguaje: Serial.print()
- Lenguaje: Serial.println()
- Lenguaje: Serial.read()
- Lenguaje: Serial.readBytes()
- Lenguaje: Serial.readBytesUntil()
- Lenguaje: Serial.readString()
- Lenguaje: Serial.readStringUntil()
- Lenguaje: serialEvent()
- Lenguaje: Serial.setTimeout()
- Lenguaje: Serial.write()
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |