raspberrypi/gpio/info_pin.c

24 lines
312 B
C
Raw Normal View History

/* 测试PIN脚是否1或0
*
*
*/
2018-03-29 20:06:23 +08:00
#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
if( argc != 2) {
exit(0);
}
int pin = atol(argv[1]);
wiringPiSetup();
pinMode(pin, OUTPUT);
printf("%d\n", digitalRead(pin));
return pin;
2018-03-29 20:06:23 +08:00
}