| Index

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

Name |  | ### digitalRead()
Examples |  |
    int inpin = 0;
    int outpin = 1;
    int val = 0;

    void setup() {
      pinMode(inpin, INPUT);
      pinMode(outpin, OUTPUT);
    }

    void loop() {
      val = digitalRead(inpin);
      if(val == HIGH)
      {
        digitalWrite(outpin, HIGH);
      } else {
        digitalWrite(outpin, LOW);
      }
    }
Description |  | The digitalRead() method reads the value of a digital input pin.
Syntax |  |
    digitalRead(pin)
Parameters |  |
pin |  | int
Returns |  | int
Usage |  | Application
Related |  | INPUT OUTPUT HIGH LOW digitalWrite() pinMode()