Hello! I'm not the greatest at scripting but I can do some. The problem with my code, is that I can only run both RGB led's or the 4 scrolling led's. What I'm trying to do is to have the 4 scrolling led's going all the time and the RGB led's going on there own program. I shortend my code alot so it will fit the 9500 charaters rule. If you could please help me with this quick fix, thanks. If not, that's ok to.
/*-----------------------------------------
The main purpose of this vode is to
flash 2 RGB led's and 4 scrolling led's
at the same time. The problem is, I can
only have one of them on at a time.
Eaither the 4 scrolling led's, are the
RGB led's.
Hope you like my code cause It took a
little time to create! I mean it works
just fine accept for the 4 led's.
-Soapy29
------------------------------------------*/
int potPin= 5;
int potVal= 0;
int delay1= 50;
int delay2= 60;
void setup() {
//----------------------------------------
// Sets up the leds to work.
//----------------------------------------
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
digitalWrite(12, HIGH);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, LOW);
digitalWrite(7, LOW);
digitalWrite(6, LOW);
digitalWrite(5, LOW);
}
void loop() {
//------------------------------
// This part scrolls 4 led's.
//------------------------------
//while (true) {
// scroll();
//}
//----------------------------
// Main commands.
//----------------------------
delay1= analogRead(potPin);
rR();
rR();
rR();
rL();
rL();
rL();
bR();
bR();
bR();
bL();
bL();
bL();
rR();
rR();
rR();
rL();
rL();
rL();
bR();
bR();
bR();
bL();
bL();
bL();
blink1();
blink2();
blink3();
blink4();
blink1();
blink2();
blink3();
blink4();
blink1();
blink2();
blink3();
blink4();
}
void rR() {
//-------------------------------------
// Blinks the right led red.
//-------------------------------------
delay1= analogRead(potPin);
digitalWrite(12, LOW);
delay(delay1);
digitalWrite(12, HIGH);
delay(delay1);
}
void rL() {
//-----------------------------------
// Blinks the left led red.
//-----------------------------------
delay1= analogRead(potPin);
digitalWrite(11, LOW);
delay(delay1);
digitalWrite(11, HIGH);
delay(delay1);
}
void bR() {
//--------------------------------------
// Blinks the right led blue.
//--------------------------------------
delay1= analogRead(potPin);
digitalWrite(10, LOW);
delay(delay1);
digitalWrite(10, HIGH);
delay(delay1);
}
void bL() {
//------------------------------------
// Blinks the left led blue.
//------------------------------------
delay1= analogRead(potPin);
digitalWrite(9, LOW);
delay(delay1);
digitalWrite(9, HIGH);
delay(delay1);
}
//------------------------------------------------
// Blinks the led's different colors.
//------------------------------------------------
void blink1() {
//rR
delay1= analogRead(potPin);
digitalWrite(12, LOW);
delay(delay1);
digitalWrite(12, HIGH);
}
void blink2() {
//rL
delay1= analogRead(potPin);
digitalWrite(11, LOW);
delay(delay1);
digitalWrite(11, HIGH);
}
void blink3() {
//bR
delay1= analogRead(potPin);
digitalWrite(10, LOW);
delay(delay1);
digitalWrite(10, HIGH);
}
void blink4() {
//bL
delay1= analogRead(potPin);
digitalWrite(9, LOW);
delay(delay1);
digitalWrite(9, HIGH);
}
void scroll() {
digitalWrite(8, LOW);
digitalWrite(7, HIGH);
delay(delay2);
digitalWrite(7, LOW);
digitalWrite(6, HIGH);
delay(delay2);
digitalWrite(6, LOW);
digitalWrite(5, HIGH);
delay(delay2);
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
delay(delay2);
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
delay(delay2);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
delay(delay2);
}