#define intPin 2
int stevec;
volatile bool m;
unsigned long timePass;
int timeDelay=500;
volatile byte stanje = LOW;
void setup() {
pinMode(intPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(intPin), ISR_prekinitev, RISING);
Serial.begin(115200);
}
void loop() {
if (m == HIGH && (millis() - timePass) >timeDelay){
m = LOW;
stevec++;
timePass=millis();
Serial.println(stevec);
}
}
void ISR_prekinitev(){
m=HIGH;
}