LED fade sequences, 2 buttons


hi everyone!
im new using arduino , need create sequence of changing patterns in led array using 2 buttons, fading , timing.

i need have pin 5 fade in on 1st press, pin 6 fade in (both pins 5 & 6 high) on 2nd press, both pins fade out on 3rd button press. program doesn't else statement, coming 'before' if:

 if (buttonpushcounter % 3 == 1) {
 // fade in min max in increments of 5 points:
 for(int fadevalue = 0 ; fadevalue <= 255; fadevalue +=5) {
   // sets value (range 0 255):
   analogwrite(ledpin_wht_dim, fadevalue);        
   // wait 30 milliseconds see dimming effect    
   delay(30);
 } else {
  digitalwrite(ledpin_wht_dim, low);
  digitalwrite(ledpin_wht_bright, low);
 }


im guessing quite simple, i'd grateful can offer me!

best regards :)

post whole code please :)

and welcome arduino.cc!


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > LED fade sequences, 2 buttons


arduino

Comments