Arduino Programming Language: DigitalRead

Name

digitalRead()

Description

DigitalRead reads the value of specified digital input pin. 
The possible values are HIGH(1) or LOW (0).

Syntax

digitalRead(pin)

Parameters

  • pin: pin number specified 

Usage

Application

Examples

int pinIN = 3;
int value = 0;

void setup() {
pinMode(pinIN, INPUT);
Serial.begin(9600);
}

void loop() {
value = digitalRead(pinIN);
Serial.print(value);
delay(1000);
}

Related Functions


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc