I know that this is to print something:
But I want to know what it really means?
Both sides of the serial connection (i.e. the Arduino and your computer) need to be set to use the same speed serial connection in order to get any sort of intelligible data. If there's a mismatch between what the two systems think the speed is then the data will be garbled.
9600 bits per second is the default for the Arduino, and is perfectly adequate for the majority of users, but you could change it to other speeds:
A picture is worth 1000 words, so they say, (1024 words if you work with computers) so I'll post some pictures ...
I set up my Uno to send "Fab" at 9600 baud and captured the results on a logic analyzer.
The parts shaded in red are the "idle" period between bytes.
From the above graphic note that the Tx (transmit) data line is normally high (1) until it drops low to indicate the start of a character (byte). This is the start bit. Then the 8 data bits (indicated by white dots) appear at the baud rate (9600 samples per second). After that the line is brought high again. This is the stop bit (the red part). Then we see the start bit for the next character, and so on. The "stop" portion can be indefinitely long, however it has to be at least one bit length.
More detail for the first character (the letter "F" or 0x46 or 0b01000110) can be seen here:
You can see from the logic analyzer capture that
Thus the rate of 9600 gives you the number of bits per second and the inverse is the time interval between bits.
If you start listening to serial data in the middle of a stream, it is quite possible that a 0-bit in the middle of the stream will be interpreted as a start bit, and then the receiver will interpret everything after that incorrectly.
The only real way to recover from this is to have a large enough gap, from time to time, (eg. 10 bits long) that this cannot happen.
The bits shown here (logic-level) are not inverted. That is, a 1-bit is HIGH and a 0-bit is LOW. If you have RS232 equipment that will probably be sending something like -12 V for a 1-bit, and +12 V for a 0-bit. This is inverted because a one is less than a zero, voltage-wise.
If you have such devices you need to do voltage conversion and logic inversion. Chips like the MAX232 will do both for you. They can also provide the -12 V needed to drive such equipment by generating it internally with the help of a few user-supplied capacitors.
Since, with one start bit, 8 data bits, and one stop bit we have a total of 10 bits, as a quick rule of thumb, you can calculate the number of bytes you can transmit in a second by dividing the bit rate by 10.
Eg. At 9600 BPS you can send 960 bytes per second.
Code to reproduce:
;TLDR; It initializes the serial communication port and sets the baud rate. The device you're communicating with (or Arduino IDE Serial Monitor) have to be set to a matching baud rate. Once you've initialized the port you can begin sending or receiving characters. Arduino Serial Reference
It specifies the program to work inside the computer system .The numbers specify the speed.Serial.print specifies what text is going to be displayed