Frequency Counter Code Error

Hi all, looking for help with a code error. (I can handle the electronics but code is not my strong point).

I have copied manually the Frequency Counter source code from the book "Arduino Projects for Amateur Radio" and when I do a verify I get the following error;

"FreqCounter" has not been declared.

I have attached my source code and wonder if anyone can give me some guidance please.

Cheers, Rod.
VK7EH

Transceiver_VFO_Display.ino (3.53 KB)

Post the EXACT errors, and ALL of them.

Did you download and install the FreqCount library?

The variable, frq, declared at the end of setup() goes out of scope immediately. You can not then use that variable in loop().

Hi, thanks for the reply. Yes I did download the FreqCount.h library.

I re-posted my original message with a different attachment as I realised quickly that the wrong file had been attached. I do not see the variable frq in my set up.

The only message I get is a per first post - "FreqCounter" has not been declared.

I appreciate any help, I am not to good at code and would like to get this working for my transceiver project.

cheers, Rod.

The only message I get is a per first post - "FreqCounter" has not been declared.

That may be the only message, but it is not the complete message. Post the COMPLETE message.

is FreqCounter defined in FreqCount.h ?
Where is FreqCount.h located ?

Odd, when I compile your code, I get a lot of errors (it helps to click the "copy error message" button)

Arduino: 1.8.9 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\Brian\Downloads\Transceiver_VFO_Display\Transceiver_VFO_Display.ino: In function 'void loop()':

Transceiver_VFO_Display:80:3: error: 'FreqCounter' has not been declared

   FreqCounter::f_comp=CALIBRATION;      // Calibrate with known source.

   ^

Transceiver_VFO_Display:81:3: error: 'FreqCounter' has not been declared

   FreqCounter::start(GATETIME);         // Count pulses for specified gating period.

   ^

Transceiver_VFO_Display:83:10: error: 'FreqCounter' has not been declared

   while (FreqCounter::f_ready == 0)

          ^

Transceiver_VFO_Display:85:12: error: 'FreqCounter' has not been declared

   dataIn = FreqCounter::f_freq;;

            ^

C:\Users\Brian\Downloads\Transceiver_VFO_Display\Transceiver_VFO_Display.ino:77:7: warning: unused variable 'i' [-Wunused-variable]

   int i;

       ^

C:\Users\Brian\Downloads\Transceiver_VFO_Display\Transceiver_VFO_Display.ino: At global scope:

Transceiver_VFO_Display:122:1: error: expected declaration before '}' token

 }

 ^

Using library FreqCount-master at version 1.3 in folder: C:\Users\Brian\Documents\Arduino\libraries\FreqCount-master 
Using library LiquidCrystal at version 1.0.7 in folder: C:\Users\Brian\Documents\Arduino\libraries\LiquidCrystal 
exit status 1
'FreqCounter' has not been declared

I don't know which FreqCount library you are using but the one I have uses FreqCount.begin() and available() and read(). Look at the example code that came with the library (File->Examples->FreqCount->LCD Output")

Hi all, thanks for all the answers and questions. I have downloaded a different FreqCounter library and also selected a different board to compile to. I now have the code compiled.

This was my first time on the forum and I have learnt a few things, like you can copy the complete error message (I think I said early on that I am a novice at code)

Again, thanks for your time and hopefully when I get my buffer and pre-scaler board together I will have a working counter for my project.

cheers, Rod.
VK7EH

rod411964:
Hi all, looking for help with a code error. (I can handle the electronics but code is not my strong point).

I have copied manually the Frequency Counter source code from the book "Arduino Projects for Amateur Radio" and when I do a verify I get the following error;

"FreqCounter" has not been declared.

I have attached my source code and wonder if anyone can give me some guidance please.

Cheers, Rod.
VK7EH

Hi, what is your meter's working range?

I was able to read about 500khz using the timer1 and interrupt: External input for the timer1 to generate an interrupt when the counter reaches the maximum · Issue #38 · PaulStoffregen/TimerOne · GitHub

Hi, I have not finished construction yet but it will be used at 11MHz to read the VFO frequency of my radio.

I will be using a prescaler circuit to get this high.

cheers, Rod.