Unknown Error

Hey,

Writing a simple program for data logging research but keep running into this issue. I'm not sure (obviously) what's wrong but I think it has to do with the FreqCount library I'm using. Any help would be appreciated.

---------------------- CODE --------------------------------------------

#include <FreqCount.h>

int tc = 0; // For getting 3 tones
int cc = 0; // for indexing the coloums in the array
int rc = 0; // for indexing the rows in the array

// 30 atn toward & 30 atn away. 20s each
int FreqResults[20][60];

void setup() {
Serial.begin(57600);

}

void loop() {

if ((cc%2) == 0){
// Wait for participant to start expt
while (digitalRead(A2) == HIGH){
}
}

// Provide 3 tones then begin
//Add this into above if statement to exclude tones during control session
while (tc < 3){
noTone(2);
tone(2, 500, 1000);
delay(1000);
tc = tc + 1;
}

// Start counting freq
FreqCount.begin(1000);

while (rc < 21){
if (FreqCount.available()) {
//Adding the freq to the matrix of data
FreqResults[rc][cc] = FreqCount.read();
Serial.println(FreqCount.read());
// Going down a row after each measurment
rc = rc + 1;
}
}

// Going over a col after a set
cc = cc + 1;
tc = 0;
FreqCount.end();
noTone(2);
tone(2, 500, 3000);
delay(1000);

}

----------------------------------------------ERROR MESSAGE -------------------------------------------------

Arduino: 1.8.8 (Windows 7), Board: "Arduino/Genuino Uno"

Build options changed, rebuilding all
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port':

(.text+0x0): multiple definition of `__vector_7'

libraries\FreqCount-1.3.0\FreqCount.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

You're trying to use the same timer interrupt for both the measurement and generating the tone.

Then there's the 2400 bytes of RAM that you may not have.

Please remember to use code tags when posting code

int FreqResults[20][60];

How many bytes is this?

Mark

Ohh is that in the final part where the FreqCount.end(); & tone(2, 500, 3000); commands are? And I'm using an ATmega328 so that should have enough memory right?

@holmes4 it's will just be full of 3 digit numbers so it'll be pretty small

And I'm using an ATmega328 so that should have enough memory right?

Wrong

@holmes4 it's will just be full of 3 digit numbers so it'll be pretty small

An egg carton to hold extra large eggs is the same physical size as one to hold small eggs.

The fact that you are storing small values in big boxes does not change the size of the box. The box is 2 bytes, and you have 1200 of them. You have room for 2000 bytes.

Ohh is that in the final part where the FreqCount.end(); & tone(2, 500, 3000); commands are?

What is? What are you talking about?

Cdiggitydawg:
@holmes4 it's will just be full of 3 digit numbers so it'll be pretty small

If my maths is correct 20 * 60 * 2 = 2400 bytes

...R

Versus 2048 bytes of ram on the 328p, for that plus all other variables in your sketch, and the serial buffer.

Fair enough, back to the drawing board then