I just started arduino and i need some help with a code. I'm using 8 leds and one button and here's what I want to do: press button once-1 led goes on, press button again-2 leds go on, press button 3th time-3leds goes on...press button 8th time-8leds go on. I tried with switch but I can't figure it out. Can someone help me or give me an idea?
You need to detect when the button becomes pressed rather than when it is pressed. Look at the StateChangeDetection example in the IDE for an example of how to do it.