volatile uint32_t count=0;
void incrementCount(){
count++;
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(2, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(2), incrementCount, RISING);
}
void loop() {
Serial.print("Interrupt count:");
noInterrupts();
Serial.println(count);
interrupts();
// put your main code here, to run repeatedly:
delay(100); // this speeds up the simulation
}Loading
st-nucleo-l031k6
st-nucleo-l031k6