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 | digitalRead() |
||
---|---|---|---|
Examples | int inpin = 8; int outpin = 9; 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 |
|
||
Returns | int | ||
Usage | Application | ||
Related | INPUT OUTPUT HIGH LOW digitalWrite() pinMode() |