You have detachInterrupt() at the start of loop() and attachInterrupt() at the end of loop(). Do you really expect that interrupt to get any useful number of spikes if it's deactivated most of the time?
You have detachInterrupt() at the start of loop() and attachInterrupt() at the end of loop(). Do you really expect that interrupt to get any useful number of spikes if it's deactivated most of the time?