我正在尝试使用 WiringPI 将中断附加到引脚wiringPilSR
。我的代码如下所示:
#include <wiringPi.h>
#include <stdio.h>
int inPin = 3;
void myInterrupt();
int main(vodi){
wiringPilSetupGpio();
pinMode(inPin, INPUT);
wiringPilSR(inPin, INT_EDGE_RISING, &myInterrupt);
while(1){
printf("Cycle repeated\n");
delay(1000);
}
return 0;
}
void myInterrupt(){
printf("Interrupted");
return 0;
}
当我尝试在 Geany 中构建代码时,我收到警告“ implicit declaration of function 'wiringPilSR'
”和错误“ undefined reference to 'wiringPilSR'
”。我已经设置了构建命令,如本教程中所示的 sparkfun