[c]void setup(){} // sets up the program
void loop() { //main loop of the program
RGB(255, 255, 255); // this calls the RGB function
delay(1000); //stays on white for one second
RGB(0, 0, 255);
delay(1000);
RGB(0,120,255);
delay(1000);
RGB(0, 255, 0);
delay(1000);
RGB(255, 0, 255);
delay(10);
RGB(0,0,0);
delay(1000);
}
void RGB(int R, int G, int B) {
for (int i = 0; i <= 255; i++) { if (i >= prevR – R && prevR < R) { analogWrite(Red, prevR + i); } if (i >= prevG – G && prevG < G) { analogWrite(Green, prevG + i); } if (i >= prevB – B && prevB < B) {
analogWrite(Blue, prevB + i);
}[/c]