Christmas Tree


good evening,
first @ all, sorry english.
i'm new in arduino's world , i'd want create christmas tree in figure , wrote program, don't think good.
i'd want put botton before circuit every "touch" i'll put button change function of christmas tree.
so:

first touch:
all leds light on , second later light off.

second touch:
the leds turn on 1 one e turn off 1 one.

third touch:
some leds light on , after light on other leds.
some leds light off , after light off other leds.

fourth touch:
the leds light on , light off sequentially.

i put program wrote , image of similar christmas tree in "attachments".

help me please finish project. i'd want give present.

if speaks italian it'd fantastic!!!

thanks much!!!


make life bit cleaner using more compact code:
make functions after void loop() different things want do. here function turning leds on , function turning them off after x time.
code: [select]



void setup() {
  // put setup code here, run once:

}

void loop() {

  //calls function. make list of custom functions in here.
  all_on_all_off(5);

}


//a function turn on....delay (x) seconds , turn leds off
void all_on_all_off(int x) {

  for (byte = 2; < 13; i++) {

    digitalwrite(i, high);

  }
  delay(x * 1000);

  for (byte = 2; < 13; i++) {

    digitalwrite(i, low);

  }

}



Arduino Forum > Using Arduino > Programming Questions > Christmas Tree


arduino

Comments