+3

In C++, for arduino more specifically, what means Serial.begin (9600)?

Serial Begin Arduino

9/25/2018 10:13:08 AM

Côme Larroque

6 Answers

New Answer

+6

The begin() method sets the baud rate or the rate of data transfer in bits per second, as different rates are required for different devices. The current call will set the baud rate to 9600, which is the default data transfer rate for communication between the Arduino and the computer.

+3

Thank you for your response. If I understand well, by example, the arduino Uno card has a rate of transfer of 9600 b/s, and other cards (like Arduino Raspberry, Arduino mega) have others rate of transfer? Is it always necessary to write the serial.begin?

+3

Côme Larroque The transfer rate is the optimal rate for efficient communication. The computer and arduino microcontroller can both work with different rates, but during communication, these rates should be same. Some devices like sensors have a fixed baud rate, and to communicate with those, the microcontroller's baud rate must match with the devices'. The rate is necessary, otherwise it may happen that the microcontroller may use some other rate and then your data will get corrupted/garbled during transfer. Its better to be safe and specify the rate yourself. The default rate set by the IDE is 9600, and so we set the rate to 9600.

+3

Ok, it's more clear now. What is the utility of set the rate to 9600b/s if the rate by default is already 9600b/s ?

+2

Côme Larroque If you open Serial Monitor, you will find a list that will be showing 9600 baud by default. Click it and change to change the baud rate of the computer. But that must be done if you wrote a new Serial.begin() in your setup().

+2

Ok, thank you !