Syntax
int digitalRead(
    uint32_t ulPin
);
ContentsIndex
PreviousUpNext
digitalRead
Example
Syntax
int digitalRead(
    uint32_t ulPin
);
Description

Reads voltage of assigned pin, HIGH or LOW. 

There are 16 pins on LinkIt ONE used as digital I/O, they are D0 ~ D13 and D18/D19, particularly D18/D19 are shared with Wire/I2C.

Parameters
Parameters 
Description 
uint32_t ulPin 
[IN] Pin number that needs to read voltage 
Returns

HIGH or LOW

Example
#define LED     13
#define BUTTON  8
void setup()
{
    pinMode(LED, OUTPUT);
    pinMode(BUTTON, INPUT);
}
void loop()
{
    int n= digitalRead(BUTTON);
    if (n == HIGH)
    {
        digitalWrite(LED, LOW);
    }
    else
    {
        digitalWrite(LED, HIGH);
    }
    delay(2000);
}
File

wiring_digital.h

Group