Index
 
  The Wiring 1.0 _ALPHA_ Reference is a work in progress.
If you see any errors or have any comments, please write to: hbarragan [at] uniandes.edu.co
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()