That's what I get for writing code in Notepad, and writing the same program for Arduino and Processing (which is where arduino.digitalWrite(bluePin, LOW) came from - a botched copy-paste from an e-mail to myself).
I'll fix the points you mentioned and throw it back up once I've gotten it to work - I know for a fact I'm not the only person working on this at this time.
It seems like all the problems you identified are all syntax problems rather than logic, so I have hope that the concept itself is solid.
EDIT:
This worked. Thanks everyone for the help.
//Setup the timing variables
long onInterval = 250;
long offInterval = 250;
long interval = onInterval;
//Track the last time the time was updated
long lastMillis = millis();
//Variable to track where in the pattern we are
int flashPatternStepper = 0;
//Variable to track which pattern is being used
int flashPatternSelect = 0;
//Array of possible flash patterns
int flashPatterns [2][4] = {{1, 0, 2, 0},
{1, 2, 1, 2}};
int arrayLength = 4;
//Variables to track color selection
char color1 = 'r';
char color2 = 'b';
//Pins for the RGB LED
int redPin = 9;
int greenPin = 10;
int bluePin = 11;
//Normal setup just setting pin modes
void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
//loop() only calls the handleLEDs function for now
void loop()
{
handleLEDs();
//Code to change values of flashPatternSelect, onInterval, offInterval, color1, and color2
}
void handleLEDs()
{
//Check to see if lights should be on or off
if(flashPatterns[flashPatternSelect][flashPatternStepper] == 0)
{
interval = offInterval;
}
else
{
interval = onInterval;
}
//Check if we need to advance flashPatternStepper to the next place in the sequence
if(millis() - lastMillis > interval)
{
lastMillis = millis();
flashPatternStepper++;
if(flashPatternStepper > arrayLength-1)
{
flashPatternStepper = 0;
}
}
//colorSelect decides which LED Pins should be active, if any
colorSelect();
}
//Control the colors
void colorSelect()
{
char colorChoice;
///Set colorChoice based on where we are in the sequence
switch (flashPatterns[flashPatternSelect][flashPatternStepper])
{
case 1:
colorChoice = color1;
break;
case 2:
colorChoice = color2;
break;
case 0:
colorChoice = 'o';
break;
}
//Actually turn on/off the LED pin(s)
switch(colorChoice)
{
case 'y':
digitalWrite(redPin, LOW);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, HIGH);
break;
case 'w':
digitalWrite(redPin, LOW);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, LOW);
break;
case 'r':
digitalWrite(redPin, LOW);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, HIGH);
break;
case 'g':
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, HIGH);
break;
case 'b':
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, LOW);
break;
case 'p':
digitalWrite(redPin, LOW);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, LOW);
break;
case 'c':
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, LOW);
digitalWrite(bluePin, LOW);
break;
case 'o':
digitalWrite(redPin, HIGH);
digitalWrite(greenPin, HIGH);
digitalWrite(bluePin, HIGH);
break;
}
}