Search wiring.org.co:

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.

Name |

### analogRead()

Examples |
    int inpin = 0;
    int val = 0;

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

    void loop() {
      val = analogRead(inpin);  // read the value of analog pin 0
      Serial.println(val);        // write the value to the serial port
    }
Description | The analogRead() method reads the value of an analog input pin. Possible values range is 0-1023, where 0 is 0 volts and 1023 is 5 volts.
Syntax |
    analogRead(pin)
Parameters |

pin | int: the analog pin numer to read

Returns | int: the value read from the analog pin
Usage | Application
Related | analogReference() analogWrite()

Updated on July 07, 2011 11:07:47pm PDT