Here's my entire code:
//Pin Number Assignments:
const int LED01 = 1;
const int LED02 = 2;
const int LED03 = 3;
const int LED04 = 4;
const int LED05 = 5;
const int LED06 = 6;
const int LED07 = 7;
const int LED08 = 8;
const int LED09 = 9;
int brightness1 = 0; // how bright the LED is
int fadeAmount1 = 5; // how many points to fade the LED by
int brightness2 = 0; // how bright the LED is
int fadeAmount2 = 5; // how many points to fade the LED by
void setup()
{
pinMode(LED01, OUTPUT);
pinMode(LED02, OUTPUT);
pinMode(LED03, OUTPUT);
pinMode(LED04, OUTPUT);
pinMode(LED05, OUTPUT);
pinMode(LED06, OUTPUT);
pinMode(LED07, OUTPUT);
pinMode(LED08, OUTPUT);
pinMode(LED09, OUTPUT);
randomSeed(analogRead(0));
}
void loop()
{
FlashPair();
Sequence();
Ramp1();
Ramp2();
}
void FlashPair()
{
digitalWrite(LED01, HIGH); digitalWrite(LED03, HIGH);
digitalWrite(LED02, LOW); digitalWrite(LED04, LOW);
delay(500);
digitalWrite(LED01, LOW); digitalWrite(LED03, LOW);
digitalWrite(LED02, HIGH); digitalWrite(LED04, HIGH);
}
void Sequence()
{
long randNumber;
//5 ~~ 5 ~~ 8 ~~ 8 ~~ 7 ~~ 7
//8 ~~ 7 ~~ 5 ~~ 7 ~~ 5 ~~ 8
//7 ~~ 8 ~~ 7 ~~ 5 ~~ 8 ~~ 5
randNumber = random(1, 6);
if (randNumber == 1)
{
digitalWrite(LED05, HIGH); delay(500); digitalWrite(LED05, LOW); delay(500);
digitalWrite(LED08, HIGH); delay(500); digitalWrite(LED08, LOW); delay(500);
digitalWrite(LED07, HIGH); delay(500); digitalWrite(LED07, LOW);
}
if (randNumber == 2)
{
digitalWrite(LED05, HIGH); delay(500); digitalWrite(LED05, LOW); delay(500);
digitalWrite(LED07, HIGH); delay(500); digitalWrite(LED07, LOW); delay(500);
digitalWrite(LED08, HIGH); delay(500); digitalWrite(LED08, LOW);
}
if (randNumber == 3)
{
digitalWrite(LED08, HIGH); delay(500); digitalWrite(LED08, LOW); delay(500);
digitalWrite(LED05, HIGH); delay(500); digitalWrite(LED05, LOW); delay(500);
digitalWrite(LED07, HIGH); delay(500); digitalWrite(LED07, LOW);
}
if (randNumber == 4)
{
digitalWrite(LED08, HIGH); delay(500); digitalWrite(LED08, LOW); delay(500);
digitalWrite(LED07, HIGH); delay(500); digitalWrite(LED07, LOW); delay(500);
digitalWrite(LED05, HIGH); delay(500); digitalWrite(LED05, LOW);
}
if (randNumber == 5)
{
digitalWrite(LED07, HIGH); delay(500); digitalWrite(LED07, LOW); delay(500);
digitalWrite(LED05, HIGH); delay(500); digitalWrite(LED05, LOW); delay(500);
digitalWrite(LED08, HIGH); delay(500); digitalWrite(LED08, LOW);
}
if (randNumber == 6)
{
digitalWrite(LED07, HIGH); delay(500); digitalWrite(LED07, LOW); delay(500);
digitalWrite(LED08, HIGH); delay(500); digitalWrite(LED08, LOW); delay(500);
digitalWrite(LED05, HIGH); delay(500); digitalWrite(LED05, LOW);
}
}
void Ramp1()
{
// set the brightness of pin 6:
analogWrite(LED06, brightness1);
// change the brightness for next time through the loop:
brightness1 = brightness1 + fadeAmount1;
// reverse the direction of the fading at the ends of the fade:
if (brightness1 <= 0 || brightness1 >= 255)
{
fadeAmount1 = -fadeAmount1;
}
// wait for 20 milliseconds to see the dimming effect
delay(20);
}
void Ramp2()
{
delay(150);
// set the brightness of pin 9:
analogWrite(LED09, brightness2);
// change the brightness for next time through the loop:
brightness2 = brightness2 + fadeAmount2;
// reverse the direction of the fading at the ends of the fade:
if (brightness2 <= 0 || brightness2 >= 255)
{
fadeAmount2 = -fadeAmount2;
}
// wait for 50 milliseconds to see the dimming effect
delay(50);
}
Everything seems to be working... except that pin 6 & pin 9 seem to be on, both at the same brightness, and aren't fading or brightening. Am I missing something here?