Embedded Programming‎ > ‎Examples‎ > ‎

Read Analog Pin

Code:

#define INPUT_PIN 1  //this will be the input pin on our Arduino's analog bank

int Value;           //variable to store the inputted value

void setup(){}       //since analog pins can only be input pins, no pinMode setup is required

void loop(){
    Value=analogRead(INPUT_PIN);    //read analog pin A1 and store its value as Value
}

 



Comments