const int geigerPin = 2; volatile unsigned int clickCount = 0; void countClick() { clickCount++; } void setup() { Serial.begin(9600); pinMode(geigerPin, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(geigerPin), countClick, FALLING); } void loop() { Serial.println("1"); for (int i = 0; i < 50; i++) { clickCount = 0; delay(4000); Serial.println(clickCount); } Serial.println("1"); for (int i = 0; i < 50; i++) { clickCount = 0; delay(4000); Serial.println(clickCount); } // Freeze the Arduino so it doesn't loop infinitely while(true) { delay(1000); } }