Hello all! I'm new here... I've been using Arduinos for a little while and I'm doing some summer research with a project that's based on an Arduino. I'm using a Mega (well, two actually) to create an imaging device using LEDs as emitters and receivers of light (project wiki at led-brdf.wikispaces.com).
I'm writing some code for the device but I'm encountering the most frustrating errors with an array. See, I'm controlling a variety of LEDs with the Arduino. Visualize 32 LEDs. For the first sequence, I want to turn LED #1 on, and sense using LEDs 2-32. For the second sequence, I want to turn LED 2 on, and sense using LEDs 1, 3-32. My plan was to use an array to initialize the LED sequences - I could have one column per sensing sequence, which interfaces very well with some code I've been using for the actual sensing part of the routine. The arrays look like this:
byte LEDcathodes[15][16] = {A1, A0, A0, A0, A0, A0, A0, A0, A0, A0, A0, A0, A0, A0, A0, A0,
A2, A2, A1, A1, A1, A1, A1, A1, A1, A1, A1, A1, A1, A1, A1, A1,
A3, A3, A3, A2, A2, A2, A2, A2, A2, A2, A2, A2, A2, A2, A2, A2,
A4, A4, A4, A4, A3, A3, A3, A3, A3, A3, A3, A3, A3, A3, A3, A3,
A5, A5, A5, A5, A5, A4, A4, A4, A4, A4, A4, A4, A4, A4, A4, A4,
A6, A6, A6, A6, A6, A6, A5, A5, A5, A5, A5, A5, A5, A5, A5, A5,
A7, A7, A7, A7, A7, A7, A7, A6, A6, A6, A6, A6, A6, A6, A6, A6,
A8, A8, A8, A8, A8, A8, A8, A8, A7, A7, A7, A7, A7, A7, A7, A7,
A9, A9, A9, A9, A9, A9, A9, A9, A9, A8, A8, A8, A8, A8, A8, A8,
A10, A10, A10, A10, A10, A10, A10, A10, A10, A10, A9, A9, A9, A9, A9, A9,
A11, A11, A11, A11, A11, A11, A11, A11, A11, A11, A11, A10, A10, A10, A10, A10,
A12, A12, A12, A12, A12, A12, A12, A12, A12, A12, A12, A12, A11, A11, A11, A11,
A13, A13, A13, A13, A13, A13, A13, A13, A13, A13, A13, A13, A13, A12, A12, A12,
A14, A14, A14, A14, A14, A14, A14, A14, A14, A14, A14, A14, A14, A14, A13, A13,
A15, A15, A15, A15, A15, A15, A15, A15,A15, A15, A15, A15, A15, A15, A15, A14}; //this array is the firing sequence, by column.
int LEDanodes[15][16] = {5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
9, 9, 9, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
11, 11, 11, 11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
13, 13, 13, 13, 13, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
21, 21, 21, 21, 21, 21, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
23, 23, 23, 23, 23, 23, 23, 21, 21, 21, 21, 21, 21, 21, 21, 21,
25, 25, 25, 25, 25, 25, 25, 25, 23, 23, 23, 23, 23, 23, 23, 23,
27, 27, 27, 27, 27, 27, 27, 27, 27, 25, 25, 25, 25, 25, 25, 25,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 27, 27, 27, 27, 27, 27,
31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 29, 29, 29, 29, 29,
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 31, 31, 31, 31,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 33, 33, 33,
37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 35, 35,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 37}; // this is the anode firing sequence, corresponding to LEDcathodes.
Here, each column is a separate lighting sequence - I can pass a given column to the sensing function and not worry about interfering with the LED that is acting as a normal emitter. The problem I'm running into with these is that when I compile the entire program (these arrays plus the actual sensing code), I get an error from the compiler that says that "LEDcathodes has not been declared". I find this strange, because I can compile both of these arrays on their own (just in an empty sketch with void setup and loop) without any problems. After three hours of trying to investigate why this is happening, I figured I'd come and ask some people who actually knew about programming (I've been teaching myself C++ all week to do this). Might anybody know why the compiler is giving this error, or any possible workarounds? I've been working with it all morning and I haven't accomplished much.
Thanks,
Kevin