raspberrypi/raspberrypi_zero/gpio/info_sound.c
2018-02-10 22:45:55 +08:00

24 lines
366 B
C

#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int main(int argc, char *argv[])
{
if(argc != 2) {
exit(0);
}
int pin = atol(argv[1]);
int status = 0;
wiringPiSetup();
pinMode(pin, INPUT);
pullUpDnControl(pin, PUD_DOWN);
status = digitalRead(pin);
printf("%d\n", status);
}