Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint8_t interruptPin = 14;
- volatile byte interruptCounter = 0;
- int numberOfInterrupts = 0;
- bool flagCred = false;
- //--------------------------------------------------------------------------
- void ICACHE_RAM_ATTR handleInterruptISR()
- {
- flagCred = true;
- }
- //--------------------------------------------------------------------------
- void setup()
- {
- Serial.begin(115200);
- pinMode(interruptPin, INPUT_PULLUP);
- attachInterrupt(interruptPin, handleInterruptISR, RISING);
- }
- //--------------------------------------------------------------------------
- void loop()
- {
- if (flagCred == true)
- {
- if (digitalRead(interruptPin) == LOW)
- {
- delay(10);
- if (digitalRead(interruptPin) == LOW)
- {
- flagCred = false;
- interruptCounter++;
- Serial.println(interruptCounter);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement