Hi all,
I am just at the final stage of my final year project and cannot for the life of me get the FreqCounter library to compile for me for the Arduino Due.
I can only assume the pins that go to the chips from the pins of the Due are different. But it doesn't even want to compile.
What I have done so far is to remove the bad encoding from the .cpp and .h file. It tries to compile better now but it complains about the following...
/tmp/buildf2fd1cc70aba7b12574f44d6ebaaa7a4.tmp/sketch/FreqCounter/FreqCounter.cpp:8:6: warning: unused parameter 'ms' [-Wunused-parameter]
void FreqCounter::start(int ms)
^
/tmp/buildf2fd1cc70aba7b12574f44d6ebaaa7a4.tmp/sketch/FreqCounter/FreqCounter.cpp: In function 'void TIMER2_COMPA_vect()':
/tmp/buildf2fd1cc70aba7b12574f44d6ebaaa7a4.tmp/sketch/FreqCounter/FreqCounter.cpp:60:5: error: 'TCCR1B' was not declared in this scope
TCCR1B = TCCR1B & ~7; // Gate Off / Counter T1 stopped
^
/tmp/buildf2fd1cc70aba7b12574f44d6ebaaa7a4.tmp/sketch/FreqCounter/FreqCounter.cpp:61:5: error: 'TIMSK2' was not declared in this scope
TIMSK2 &= ~(1<<OCIE2A); // disable Timer2 Interrupt
^
/tmp/buildf2fd1cc70aba7b12574f44d6ebaaa7a4.tmp/sketch/FreqCounter/FreqCounter.cpp:61:20: error: 'OCIE2A' was not declared in this scope
TIMSK2 &= ~(1<<OCIE2A); // disable Timer2 Interrupt
^
/tmp/buildf2fd1cc70aba7b12574f44d6ebaaa7a4.tmp/sketch/FreqCounter/FreqCounter.cpp:62:5: error: 'TIMSK0' was not declared in this scope
TIMSK0 |=(1<<TOIE0); // enable Timer0 again // millis and delay
^
/tmp/buildf2fd1cc70aba7b12574f44d6ebaaa7a4.tmp/sketch/FreqCounter/FreqCounter.cpp:62:18: error: 'TOIE0' was not declared in this scope
TIMSK0 |=(1<<TOIE0); // enable Timer0 again // millis and delay
^
/tmp/buildf2fd1cc70aba7b12574f44d6ebaaa7a4.tmp/sketch/FreqCounter/FreqCounter.cpp:66:28: error: 'TCNT1' was not declared in this scope
FreqCounter::f_freq += TCNT1; // add counter1 value
^
/tmp/buildf2fd1cc70aba7b12574f44d6ebaaa7a4.tmp/sketch/FreqCounter/FreqCounter.cpp:71:9: error: 'TIFR1' was not declared in this scope
if (TIFR1 & 1) { // if Timer/Counter 1 overflow flag
^
/tmp/buildf2fd1cc70aba7b12574f44d6ebaaa7a4.tmp/sketch/FreqCounter/FreqCounter.cpp:73:16: error: 'TOV1' was not declared in this scope
TIFR1 =(1<<TOV1); // clear Timer/Counter 1 overflow flag
I can only assume these timers and counters are different on the cpu on Due and it won't compile because the code is targeted at the Uno? Or I'm missing something obvious. I haven't done any C code for ages, so please excuse my rustyness.
Some guidance would be much appreciated, thanks.