thanks for your responses
i have attempted a sketch and my RGBs work as i want them and they are timed as they should be. that is, until i include the whites.
the whites are supposed to start in the beginning and fade in and out over the whole course, and the RGBs would be changing in sequences. the code compiles, but i get whites to do their thing...only all the RGBs light and stay that way.
i have tried to say the whites should read this first time and then exit that part...but perhaps there is something i am really not understanding.
if you can, please take a look at this code for the hat part of the suit...and perhaps tell me how i could have two parallel things going. bear with me if some things are messed up...it is one of my first efforts
thanks in advance
const boolean ON = LOW; //Define on LOW
const boolean OFF = HIGH;
/*
const boolean RED[] = {ON, OFF, OFF};
const boolean GREEN[] = {OFF, ON, OFF};
const boolean BLUE[] = {OFF, OFF, ON};
const boolean YELLOW[] = {ON, ON, OFF};
const boolean CYAN[] = {OFF, ON, ON};
const boolean MAGENTA[] = {ON, OFF, ON};
const boolean WHITE[] = {ON, ON, ON};
*/
const boolean BLACK[] = {OFF, OFF, OFF};
//to-dimensionel array af hver LEDs 3 pin-nummre
int LEDPins[3][3] = {{2, 3, 4},
{5, 6, 7},
{8, 10, 11},};
int White = 9; // LED connected to digital pin 9
const boolean LEDColors[3][3] = {{OFF, ON, ON},
{OFF, OFF, ON},
{ON, OFF, ON}};
int prevLED = 0;
int repeat = 0;
long duration = 0;
boolean FirstTime = true;
void setup(){
pinMode (White, OUTPUT);
for(int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++){
pinMode(LEDPins*[j], OUTPUT); //Set the three LED pins as outputs*
-
}*
-
}*
}
void fadewhite (long delaytime){
-
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5){*
-
// sets the value (range from 0 to 255):*
-
analogWrite(White, fadeValue); *
-
delay(80); *
-
// fade out from max to min in increments of 5 points:*
-
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {*
-
// sets the value (range from 0 to 255):*
-
analogWrite(White, fadeValue); *
-
delay(100); *
}
}
}
void setColor(int* led, const boolean* color){
-
for(int i = 0; i < 3; i++){*
digitalWrite(led_, color*);
}
}
void cycleDressLEDs(long delayTime)
{
for (int i = 0; i < 3; i++){
setColor(LEDPins[prevLED], BLACK);
setColor(LEDPins, LEDColors);
prevLED = i;
delay(delayTime);
}*_
* }*
* void RandomCycle(long delayTime)// randomized cycle*
* {*
* for (int i = 0; i < 3; i++){*
* int rand = random(3);*
* setColor(LEDPins[prevLED], BLACK);*
_ setColor(LEDPins[rand], LEDColors*);
delay(delayTime);
}
}*
void loop(){_
* duration = millis();*
* while (duration > 0 && duration < 900000);//length of s*
* //put them on wait*
* {*
* if (FirstTime == true)*
{
fadewhite (500);//call white and then make them do their thing over the whole duration...
* FirstTime = false;*
*} *
* //set alle til sort*
* setColor(LEDPins[0], BLACK);*
* setColor(LEDPins[1], BLACK);*
* setColor(LEDPins[2], BLACK);*
* //wait five first minutes, while poem is being read*
* delay(300000);*
* //1. sequence w light (1 minute each, align with suit)*
* for (int i = 0; i < 1; i++){*
* cycleDressLEDs(60000);*
* setColor(LEDPins[0], BLACK);*
* setColor(LEDPins[1], BLACK);*
* setColor(LEDPins[2], BLACK);*
* delay (4000);*
* }*
* //2. sequence w light (faster - align w suit)*
* for (int i = 0; i < 20; i++){*
* cycleDressLEDs(1000); *
* setColor(LEDPins[0], BLACK);*
* setColor(LEDPins[1], BLACK);*
* setColor(LEDPins[2], BLACK);*
* delay (4000);*
* }*
* //3. sequence...light - fast fast*
for (int i = 0; i < 100; i++){
* cycleDressLEDs(50);*
* setColor(LEDPins[0], BLACK);*
* setColor(LEDPins[1], BLACK);*
* setColor(LEDPins[2], BLACK);*
* delay (200);*
}
//4.random sequence
for (int i = 0; i < 5; i++){
RandomCycle(3000);
* setColor(LEDPins[0], BLACK);*
* setColor(LEDPins[1], BLACK);*
* setColor(LEDPins[2], BLACK);*
}
}
}