
-----------------------------------
Natsu
Tue Sep 24, 2013 11:33 am

Controlling RGB Light with Arduino using a Button
-----------------------------------
Im trying to modify my code so that when I push the button for the first time, the led freeze's on the color. Any other time after the first press, the LED changes to a random color, and while I am not pressing the button, the transition is still smooth:

my button is on Pin 10

[code]int red = 12;
int green = 14;
int blue = 15;

int redNow;
int blueNow;
int greenNow;
int redNew;
int blueNew;
int greenNew;

void setup()
{ 
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
redNow = random(255);
blueNow = random(255);
greenNow = random(255);
redNew = redNow;
blueNew = blueNow;
greenNew = greenNow;
}

#define fade(x,y) if (x>y) x--; else if (xy) x--; else if (x