I'm also having trouble with the Frequency Counter examples, and have tried most of the suggestions within
this thread (and others). The #if and #endif lines were commented out within the Frequency.cpp file, however
the problem still exists.
The error message that is displayed when trying to upload the code is, "redefinition of 'long unsigned int frq' "
I've attached a screen shot of the entire log of errors which also shows the code version that I'm using.
The error might be caused by the board which is the Dcduino Mega 2560.
I do have an authentic Arduino Mega 2560 at home, which I'll try this evening (not sure of the chipset at the moment)
Is this message consistent with the incorrect Arduino board/chipset, or outdated .CPP file? Otherwise, I don't see any
problem with the code?
// Frequency Counter Lib example
/*
Martin Nawrath KHM LAB3
Kunsthochschule f¸r Medien Kˆln
Academy of Media Arts
http://www.khm.de
http://interface.khm.de/index.php/labor/experimente/
*/
#include <FreqCounter.h>
unsigned long frq;
int cnt;
int pinLed=13;
void setup() {
pinMode(pinLed, OUTPUT);
Serial.begin(115200); // connect to the serial port
Serial.println("Frequency Counter");
}
void loop() {
// wait if any serial is going on
FreqCounter::f_comp=10; // Cal Value / Calibrate with professional Freq Counter
FreqCounter::start(100); // 100 ms Gate Time
while (FreqCounter::f_ready == 0)
frq=FreqCounter::f_freq;
Serial.print(cnt++);
Serial.print(" Freq: ");
Serial.println(frq);
delay(20);
digitalWrite(pinLed,!digitalRead(pinLed)); // blink Led
}