Collecting and showing data through serial port
Before going any further, let's discuss how we can print something using Arduino IDE. We already printed Hello Arduino in the previous chapter. If you don't know how to print something using serial monitor, please go to the previous chapter and then come back here.
Let's recap the print program we used.
We took two functions, setup()
and loop()
. Inside the setup function, we declared our baud rate as follows:
Serial.begin(9600); //default baud for serial communication
Right after the baud was defined, we added a special function to print our text on the serial monitor. The function was Serial.print()
. Inside the print()
function, we wrote (in C we call it passed ) what we wanted to be seen on the serial monitor.
So, the full code for printing Hello Arduino is as follows:
void setup(){ Serial.begin(9600); Serial.print("Hello Arduino"); } void loop() { }
You may know the difference between Serial.print...