#include<FunctionalInterrupt.h>
class Button {
public:
int count = 0;
void ARDUINO_ISR_ATTR isr(void) {
count++;
}
};
Button b;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(26, INPUT_PULLUP);
attachInterrupt(26, std::bind(&Button::isr, &b), RISING);
}
void loop() {
// put your main code here, to run repeatedly:
delay(200); // this speeds up the simulation
Serial.println(b.count);
}