Hide minor edits - Show changes to markup
Sets the data rate in bits per second (baud) for serial data transmission. For communicating with the computer, use one of these rates: 300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200. You can, however, specify other rates - for example, to communicate over pins 0 and 1 with a component that requires a particular baud rate.
Sets the data rate in bits per second (baud) for serial data transmission. For communicating with the computer, use one of these rates: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200. You can, however, specify other rates - for example, to communicate over pins 0 and 1 with a component that requires a particular baud rate.
An optional second argument configures the data, parity, and stop bits. The default is 8 data bits, no parity, one stop bit.
Serial.begin(speed)
Serial.begin(speed)
Serial.begin(speed, config)
Serial3.begin(speed)
Serial3.begin(speed)
Serial1.begin(speed, config)
Serial2.begin(speed, config)
Serial3.begin(speed, config)
speed: in bits per second (baud) - long
speed: in bits per second (baud) - long
config: sets data, parity, and stop bits. Valid values are :
(:include Reference/SerialSeeAlsoIncludes:)
[@
(:source lang=arduino tabwidth=4:)
@]
(:sourceend:)
[@
(:source lang=arduino tabwidth=4:)
@]
(:sourceend:)
Serial.begin(speed)
Arduino Mega only:
Serial1.begin(speed)
Serial2.begin(speed)
Serial3.begin(speed)
long datarate, in bits per second (baud)
speed: in bits per second (baud) - long
int datarate, in bits per second (baud)
long datarate, in bits per second (baud)
void loop() {}
void loop() {}
// Arduino Mega using all four of its Serial ports (Serial, Serial1, Serial2, Serial3), with different baud rates
// Arduino Mega using all four of its Serial ports // (Serial, Serial1, Serial2, Serial3), // with different baud rates:
Arduino Mega example:
// Arduino Mega using all four of its Serial ports (Serial, Serial1, Serial2, Serial3), with different baud rates
void setup(){
Serial.begin(9600);
Serial1.begin(38400);
Serial2.begin(19200);
Serial3.begin(4800);
Serial.println("Hello Computer");
Serial1.println("Hello Serial 1");
Serial2.println("Hello Serial 2");
Serial3.println("Hello Serial 3");
}
Thanks to Jeff Gray for the mega example
Sets the data rate in bits per second for serial data transmission.
Sets the data rate in bits per second (baud) for serial data transmission. For communicating with the computer, use one of these rates: 300, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200. You can, however, specify other rates - for example, to communicate over pins 0 and 1 with a component that requires a particular baud rate.
int datarate, in bits per second.
int datarate, in bits per second (baud)
Serial.begin(speed);
sets the data rate for serial data transmission.
Example:
Sets the data rate in bits per second for serial data transmission.
int datarate, in bits per second.
nothing
@]
Serial.begin(speed);
sets the data rate for serial data transmission.
Example:
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}