I'm trying to attach an interrupt to a pin using wiringPI's wiringPilSR
. My code looks like this:
#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;
}
When I try to build the code in Geany, I get a warning "implicit declaration of function 'wiringPilSR'
" and error "undefined reference to 'wiringPilSR'
". I have set the build commands as shown in this tutorial on sparkfun
The function wiringPilSR
isn't spelled with a lowercase L (l)
, instead its 9th character is an uppercase i (I)
There goes one hour for figuring it out