Skip to content

Instantly share code, notes, and snippets.

@surinoel
Created July 9, 2019 03:43
Show Gist options
  • Save surinoel/07873794c7a1b32b8a150f1d0c1a2d75 to your computer and use it in GitHub Desktop.
Save surinoel/07873794c7a1b32b8a150f1d0c1a2d75 to your computer and use it in GitHub Desktop.
int pinHit = 2;
int count = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(pinHit, INPUT);
attachInterrupt(0, hitISR, FALLING);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("HIT : ");
Serial.println(count);
delay(500);
}
void hitISR(void) {
count++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment