Serial.readBytesUntil()
Descripción
Serial.readBytesUntil() lee los caracteres del buffer serie en una matriz. La función termina si:
- Se detecta el carácter terminador,
- La longitud determinada ha sido leÃdo,
- O el tiempo de espera se ha alcanzado (ver Serial.setTimeout()).
Serial.readBytesUntil() devuelve el número de caracteres leÃdos en el buffer. Un 0 significa que no se encontraron datos válidos.
Serial.readBytesUntil() hereda de la clase Stream.
Sintaxis
Serial.readBytesUntil(character, buffer, length)
Parámetros
- character: el caracter a buscar(char)
- buffer: el buffer para almacenar los bytes (char[] o byte[])
- length: tel número de bytes a leer (int)
Retornos
- Byte
Ejemplo
- Select Newline at the ending selection of Serial Monitor
- Type "HELLO" on Serial Monitor
- Click Send button:
- The result on Serial Monitor:
※ 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.available()
- 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.readString()
- Lenguaje: Serial.readStringUntil()
- Lenguaje: serialEvent()
- Lenguaje: Serial.setTimeout()
- Lenguaje: Serial.write()
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |