# newbie guestion 2 button+5 led

hi im not understand programming good and ask how i make thats, i need 2 bush button s1=up, S2=down)
and have 1,2,3,4,5 led.
need memory/var,memory, or what ?

start var=1 and led1 hight

and if bush s1 var+1 or S2 var-1
var1=out led1 high,var2=out led2 high and and and-----

if var 1 and s2 nothing happend var and led have 1
if var 1 and s1 var+1 and led 1 low and led 2 hight (ghange led)
max var 5 and s1 nothing var+led5==5
var 5 and s2 var-1=4 and led 4

mean minim=1 and maxim=5 if s1 make more than 5 nothing can do. mean if var >5 nothing if var <1 nothing.

eweru bush button s1 up or s2 down ghange led 1,2,3,4,5 and back down 5,4,3,2,1,
or 3 and s2=2 or s1 =4

and leds out if 1 high all other low.
maybe read var if var 1,2,3,4,5
if 1 led1 hight 2,3,4,5 low = 10000
if led 2 high 1,3,4,5 low= 01000
led3= = 00100
L4= 00010
L5 = 00001

or how ???

start or reset all led = 10000 ==var=1 + led=1
if s1 var+1
if s2 var -1
ghange var=varold+1 or -1

i no know,i no understand good thats
how write code ???
i think some night thats and no can start write,all i feel have wrong lot

i no know,i no understand good thats how write code ??????

You will get the skills you need at the following WEB sites.

I suggest you start with [u]This Example[/u], which is one button and one LED.

Add another button and another LED.

Then start modifying the sketch. Do NOT try to write your whole sketch all at once! Add one or two lines of code at a time, testing and de-bugging as you go. (I’ve been programming for several years, so I usually write more than one line at a time, but I never write the whole program at once… Always in little “parts”.)

Start by making the 2nd switch control the 1st LED. Then make a small change to make the 2nd switch control the 2nd LED.

Add more LEDs and test them one at a time. Keep it simple… Make the LEDs count/sequence automatically without pushing any buttons. First, make it count-up, then add the code to count-down.

Then add the code to make the count-up switch work, then the count-down switch.

Programming is not easy! The most important concepts are conditional execution (if-statements, etc.) and looping (doing things over-and-over). But there are LOTS of details, and your syntax has to be perfect…

As they said before, programming takes time and patience (and work!), but i think in the end it is really rewarding!

You could also take a look at arrays: http://arduino.cc/en/Reference/Array

arrays are like a collection of things, where each item ir ordered and has a number. So let's say you have an arrays or leds:

ledArray = {led1,led2,led3,led4}

you can then select them by saying you want the "thing number 1 from that collection", or the "thing number two",... So you can see how this would help you with two buttons to achieve that effect with 5 leds. You could have a function to light "led number x" and then the buttons would make it go either to the next or to the previous led on that Array ("collection").

I hope this made any sense. Good luck!