
Orange Pi 2G-IOT User Manual
Copy right by Shenzhen Xunlong Software Co., Ltd
www.orangepi.org
www.xunlong.tv
50
unsigned int vol;
/* Setup wiringPi */
wiringPiSetup();
/* Set Input Mode */
pinMode(PA1, INPUT);
pinMode(PB5, INPUT);
pinMode(PD2, INPUT);
/* Get value from GPIO */
vol = digitalRead(PA1);
vol = digitalRead(PB5);
vol = digitalRead(PD2);
return 0;
}
2) Set gpio as "OUTPUT" mode
All GPIO support "OUTPUT" mode. The demo code as follow:
#include <wiringPi.h>
/* Defind unique ID */
#define PA1
1
#define PB5
37
#define PC27
91
#defien PD2
98
int main(void)
{
/* Setup wiringPi */
iringPiSetup();
/* Set GPIO Mode */
pinMode(PA1, OUTPUT);
pinMode(PB5, OUTPUT);