here is my code i'm trying to get working:
int colPins[3] = {9,11,10}; // r g b pins
long previousMillis = 0;
long times[] = {500, 500, 500, 500}; // 500 ms intervals
int colors[][2] = {{0,255},{0,0},{0,255}, {0,0}}; // red pin (0 = pin 9), on off on off, repeat
long change = times[0];
int pi = 0; // pattern index for loop
int patternSize;
void setup()
{
DDRB |= 0xE; // set output pins
Serial.begin(9600);
patternSize = sizeof(times) / sizeof(long); // get size of array
}
void loop()
{
if (millis() > change) {
digitalWrite(colPins[colors[pi][0]], colors[pi][1]);
change = millis() + times[pi];
if (pi == (patternSize - 1)) {
pi = 0;
} else {
pi++;
}
}
}
it's based on the blink led without delay. it works well for a small array like that. but when i increase the array size to lets say 400+, the arduino does nothing. it compiles fine. is there a max array size that it works for?
the arrays for time and coloring are meant to come from say a bass line of a song or something. i wrote something i can play with before i make a midi decoder just to test:
http://naymyo89.googlepages.com/lightCoder.htmlyou can use numpad 1 2 and 3 to activate the colors. i'm wondering if i have a totally wrong approach to this...?
thanks