#include <stdio.h>
#include <stdlib.h>
#include <wiringPi.h>
#define BUTTONPIN 1
int counter =0;
void myinterrupt(){
counter++;
printf("counter = %d\n",counter);
}
int main(){
wiringPiSetup();
pinMode(BUTTONPIN,INPUT);
wiringPiISR(BUTTONPIN,INT_EDGE_RISING,&myinterrupt);
printf("counter = %d\n",counter);
while(1){}
return 0;
}
#include <stdlib.h>
#include <wiringPi.h>
#define BUTTONPIN 1
int counter =0;
void myinterrupt(){
counter++;
printf("counter = %d\n",counter);
}
int main(){
wiringPiSetup();
pinMode(BUTTONPIN,INPUT);
wiringPiISR(BUTTONPIN,INT_EDGE_RISING,&myinterrupt);
printf("counter = %d\n",counter);
while(1){}
return 0;
}