Arduino Programming Language: AnalogRead

Name

analogRead()

Description

AnalogRead reads the value of an analog input pin. 
The possible values are including between 0 and 1023, where 0 is 0 volt and 1023 equals 5 volts. 
Generally the resolution is 4,9mV for unit but it can be changed using analogReference.

Syntax

analogRead(pin)

Parameters

  • pin: the number of analog input pin.

Returns

int from (0 to 1023) 

Usage

Application

Examples

int pinIN = 3;
int value = 0;

void setup() {
Serial.begin(9600);
}

void loop() {
value = analogRead(pinIN);
Serial.printl(value);
}


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc