int digitalRead( uint32_t ulPin );
int digitalRead( uint32_t ulPin );
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 |
Description |
|
uint32_t ulPin |
[IN] Pin number that needs to read voltage |
HIGH or LOW
#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); }
wiring_digital.h