Example Code for Arduino-Read Analog Value
Last revision 2026/01/07
The article provides an example code for reading analog values using Arduino, detailing hardware and software preparation, wiring diagrams, sample code, and results to help users effectively set up and execute sensor data collection.
Wiring Diagram

Sample Code
int sensorvalue;
void setup(){
Serial.begin(9600);
}
void loop(){
sensorvalue = analogRead(0); // read value from different position
Serial.println(sensorvalue);
delay(200);
}
Was this article helpful?
