RGB slow color change code I did a while back.

This changes all ROYGBIV colors Hope you like it.

Justin V

define RED 11

define GREEN 10

define BLUE 9

int red;
int green;
int blue;
int fade;

void setup(){
}

void loop()
{
int red = 255;
int green = 0;
int blue = 0;

for(fade = 0 ; fade < 255; fade +=1)
{
green += 1;
red -= 1;
analogWrite(GREEN, 255 - green);
analogWrite(RED, 255 - red);
delay(75);
}
red = 0;
green = 255;
blue = 0;
for(fade = 0; fade < 255; fade +=1)
{
green-=1;
blue+=1;
analogWrite(GREEN, 255 - green);
analogWrite(BLUE, 255 - blue);
delay(75);
}
red = 0;
green = 0;
blue = 255;
for(fade = 0; fade < 255; fade +=1)
{
blue-=1;
red+=1;
analogWrite(BLUE, 255 - blue);
analogWrite(RED, 255 - red);
delay(75);
}
}

Please edit your post, select the code, and put it between [code][/code] tags.

You can do that by hitting the “Code” icon above the posting area. It is the first icon, with the symbol: </>

What is your question?