Serial.begin()
Descripción
Establece la velocidad de datos en bits por segundo (baudios) para la transmisión de datos en serie. Para comunicarse con el equipo, utilice uno de estos tipos: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600 o 115200. Puede, sin embargo, especificar otras tasas - por ejemplo, para comunicarse a través de los pines 0 y 1 con un componente que requiera una velocidad de transmisión particular.
Un segundo argumento opcional configura los datos, la paridad y bits de parada. El valor por defecto es de 8 bits de datos, sin paridad, un bit de parada.
Sintaxis
Serial.begin(speed)
Serial.begin(speed, config)
Solo Arduino Mega:
Serial1.begin(speed)
Serial2.begin(speed)
Serial3.begin(speed)
Serial1.begin(speed, config)
Serial2.begin(speed, config)
Serial3.begin(speed, config)
Parámetros
- speed: en bits por segundo (baud) - long
- config: configura los datos, paritdad, y bits de stop. Los valores válidos son:
- SERIAL_5N1
- SERIAL_6N1
- SERIAL_7N1
- SERIAL_8N1 (por defecto)
- SERIAL_5N2
- SERIAL_6N2
- SERIAL_7N2
- SERIAL_8N2
- SERIAL_5E1
- SERIAL_6E1
- SERIAL_7E1
- SERIAL_8E1
- SERIAL_5E2
- SERIAL_6E2
- SERIAL_7E2
- SERIAL_8E2
- SERIAL_5O1
- SERIAL_6O1
- SERIAL_7O1
- SERIAL_8O1
- SERIAL_5O2
- SERIAL_6O2
- SERIAL_7O2
- SERIAL_8O2
Retornos
- Ninguno.
Ejemplo
The result on Serial Monitor:
Arduino Mega example:
※ 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.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 |