Hello,
I have RGB LEDs on my wall and I have a lot of program (flashRGB, flash raimbow, up and down, up and down raimbow...).
I want to put every program in one single and when I push the button it's must pass to the next one. But it doesn't work !
Each proram = 5 to 30 secondes
I have one button (on INPUT_PULLUP)
Yes, but to pass to the next one I need to download it in arduino. And I want when I push the button he pass to the next one.
(I can't test program now I am not in my student room)
That looks better, at least you should see something happen now when you press the button. But it will still not do what you want. Try to figure out why.
const int sortieR = 3;
const int sortieV = 4;
const int sortieB = 5;
const int bouton = 10;
int tps = 2 ;
int lumin = 255 ;
void setup() {
// put your setup code here, to run once:
pinMode(sortieR, OUTPUT);
pinMode(sortieV, OUTPUT);
pinMode(sortieB, OUTPUT);
pinMode(10,INPUT_PULLUP);
}
void loop() {
while(1==1)
{
analogWrite(sortieR, 255);
analogWrite(sortieV, 0);
analogWrite(sortieB, 0);
if (digitalRead(bouton)==LOW)
{
break;
}
}
while(1==1)
{
analogWrite(sortieR, 0);
analogWrite(sortieV, 255);
analogWrite(sortieB, 0);
if (digitalRead(bouton)==LOW)
{
break;
}
}
while(1==1)
{
analogWrite(sortieR, 0);
analogWrite(sortieV, 0);
analogWrite(sortieB, 255);
if (digitalRead(bouton)==LOW)
{
break;
}
}
}
Ok, now, when I press the button it's white (go in loop and break very fast). When I take of my finger it's one of the 3 color randomly.
,
I know, it's the break does many times. I should put a mémory, but how ?