What is Serial communication for ?
If you are looking for some way to make your Arduino talk with other devices or to be able to be controlled by your computer, then you should have a look of serial communication! Serial is used for communication between the Arduino board and a computer or other devices.
Serial communication is a kind of “way” for devices to talk to each other. For example, if you build a temperature sensing Arduino project, and wanted to transmit data to the computer. Or controlling LED light on Arduino by computer. Then you might find it useful.
Let’s try some simple code with serial communication. Open your Arduino IDE and upload these codes.
If you are looking for some way to make your Arduino talk with other devices or to be able to be controlled by your computer, then you should have a look of serial communication! Serial is used for communication between the Arduino board and a computer or other devices.
Serial communication is a kind of “way” for devices to talk to each other. For example, if you build a temperature sensing Arduino project, and wanted to transmit data to the computer. Or controlling LED light on Arduino by computer. Then you might find it useful.
Let’s try some simple code with serial communication. Open your Arduino IDE and upload these codes.
void setup() {
Serial.begin(9600);
Serial.println("Hello Aconcagua!");
}
void loop() {
}
Click on the Serial Monitor button on the right hand site.
If everything goes well. Hello Aconcagua! will be printed on the your serial monitor screen.
If you see any "Align language" output on your screen. It might be because of the wrong Baud rate setting. Try to set the baud rate to 9600 baud and restart the Arduino again.
In this example, we open up a Serial communication port with 9600 bps baud rate.
And we send a few words from the Arduino back to your computer from your USB connection.
What if we change the code into this:
If you see any "Align language" output on your screen. It might be because of the wrong Baud rate setting. Try to set the baud rate to 9600 baud and restart the Arduino again.
In this example, we open up a Serial communication port with 9600 bps baud rate.
Serial.begin(9600);
And we send a few words from the Arduino back to your computer from your USB connection.
Serial.println("Hello Aconcagua!");
What if we change the code into this:
void setup() {
}
void loop() {
Serial.begin(9600);
Serial.println("Hello Aconcagua!");
delay(500);
}
You can see your Arduino keep saying hello to youIf you look at your Arduino, you can see The TX line keep blinking. It represents the data is transmitted from Arduino back to your computer.
Comments
Post a Comment