Also noticed, you might want to put
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
pinMode(12, OUTPUT);
digitalWrite(12, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(12, LOW); // set the LED off
delay(1000); // wait for a second
pinMode(11, OUTPUT);
digitalWrite(11, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(11, LOW); // set the LED off
delay(1000);
pinMode(10, OUTPUT);
digitalWrite(10, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(10, LOW); // set the LED off
delay(1000);
const int RED_LED_PIN = 9;
const int GREEN_LED_PIN = 8;
const int BLUE_LED_PIN = 7;
// Used to store the current intensity level of the individual LEDs
int redIntensity = 0;
int greenIntensity = 0;
int blueIntensity = 0;
// Length of time we spend showing each color
const int DISPLAY_TIME = 100; // In milliseconds
from loop into setup. If you want to flash each LED colour on before you start mixing colours, I'd put this into setup:
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
const int RED_LED_PIN = 9;
const int GREEN_LED_PIN = 8;
const int BLUE_LED_PIN = 7;
// Used to store the current intensity level of the individual LEDs
int redIntensity = 0;
int greenIntensity = 0;
int blueIntensity = 0;
// Length of time we spend showing each color
const int DISPLAY_TIME = 100; // In milliseconds
and this into the start of loop:
digitalWrite(12, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(12, LOW); // set the LED off
delay(1000); // wait for a second
digitalWrite(11, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(11, LOW); // set the LED off
delay(1000);
digitalWrite(10, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(10, LOW); // set the LED off
delay(1000);
Or you could turn it into a flash function:
void flash(int pin){
digitalWrite(pin, HIGH);
delay(1000);
digitalWrite(pin, LOW);
delay(1000);
}
Then call the function at the start of loop
flash(12);
flash(11);
flash(10);
Just some ideas.
Onions.