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.
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?
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.
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().