Hello all.
For a school project I've been building what essentially equates to a digital tuning machine with audio and LCD output. This project requires a list of perfect pitch notes and their respective frequencies. However, since I need to call both the note name to the LCD and the frequency to the speaker via the tone() function, I decided it would be best to define a structure with those components, and then build an array to contain it.
Since we are considering using octaves 2-6, that's quite a lot of elements, so to save room I decided to define and build the array in a header file and simply include it in the .ino file. However, I keep getting the error mentioned in the title, and I cannot figure out why. It seems to imply that I'm defining my structure incorrectly, but I can't quite find an issue.
The structure is defined as follows in pitches.h:
typedef struct {
int frequency;
String noteName;
} noteData;
noteData notelist[59];
Every piece of data is placed in the array in the same format, so here's a quick example of that. It's at these lines that the compiler gives me this error ('notelist' does not name a type), and does so at every one.
notelist[45] = {880, "A5"};
Do you have any idea what I might be doing wrong? Any help would be greatly appreciated. Also I'm a bit new to arduino as well, so I might have trouble understanding reasoning behind more complex solutions if some detail isn't given. Hopefully it's a simple fix.