Led chaser and button

Hi everyone, I did led chaser without delay and add a button to it. Separately both functions works fine, but together an error showed up. When chaser function lights all leds button function triggers too. I looked through the code but have no idea what's wrong. I'd really appreciate any help;)Code's attached below

Chaser24.ino (1.68 KB)

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom.. :slight_smile:

is there a pull-up on your button pin? it may be floating when the button is not pressed

should it be configured INPUT_PULLUP?

I guess the problem could be caused by bouncing. maybe try to debounce.

It compiles for me with no errors.

gcjr I have a pull down resistor

Please post the code that actually produces the error. First follow the instructions that were given to you in reply #1.