Then you are doing something wrong, as the code includes a test function that gets the correct answer for a 975 Hz signal.
The code will work only on AVR based Arduinos, and only with clean, 5V rectangular input pulses. Given the 16 MHz CPU clock, you probably can't expect it to work at much higher than typical audio frequencies.