Arduino Serial Print

by electronicsmith in Circuits > Arduino

645 Views, 0 Favorites, 0 Comments

Arduino Serial Print

arduino serial.jpg

Arduino serial print is used to read sensor data and display it on the human-readable format. Let understand this using an example. Suppose you have a humidity sensor and you want to know the amount of moisture present in the air. Either Arduino nor sensor have any display so their serial print come in the role.

Supplies

Arduino

USB cable

computer

Arduino IDE

Example Code

There is an example code in Arduino ide you can copy and upload the following code.

or navigate to file>example>basics>serialReadbasics

------------------------------------------------------------------------------------------------------------

// the setup routine runs once when you press reset:
void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); }

// the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // print out the value you read: Serial.println(sensorValue); delay(1); // delay in between reads for stability }

-------------------------------------------------------------------------------------------------------------------

Check this post for detailed explanation

Arduino serial print:- to display output of sensors