Frequency Counter

Hey! You are magic! At least it compiles.
But still no results: only the first “Frequency Counter” printout and nothing else.

I connected a 4.5V square wave at pin 5 (protected by a 1.5KOhm).

I modified the sketch adding some check point (A,B,C) to see where it stops. It just prints a fast serie of “C” as if the parameter “frq” doesn't exist (or empty).

And b.t.w. where is declared that pin 5 is an input?

What do you suggest? Is something I can do the get it running?

Thanks for your patient support. :slight_smile:

#include <FreqCounter.h>

void setup() {
Serial.begin(57600); // connect to the serial port
Serial.println("Frequency Counter");
}

long int frq;
void loop() {

FreqCounter::f_comp= 8; // Set compensation to 12
Serial.println("A");
FreqCounter::start(1000); // Start counting with gatetime of 100ms
Serial.println("B");
while (FreqCounter::f_ready == 0) // wait until counter ready
Serial.println("C");
frq=FreqCounter::f_freq; // read result
Serial.println(frq); // print result
delay(20);
}