int potPin = 0; // input pin for the potint timer = 50; // you can adjust the numbers below to set the max and min for the speed adjustment int x = 10; // sets the max speed (0 = fast) the lower the number the faster it can go int y = 300; // sets the min speed (100 = slow) the higher the number the slower it can go

if (lightMode == 0) { // if its left to right lightMode = 1; // chase left to right then back! } else { if (lightMode == 1) { // if its left to right then back lightMode = 2; // all off } else { if (lightMode == 2) { // if its all off lightMode = 0; } } can be replaced by this

I don't see AttachInterrupt in your code. Anyway, as kerthyn says, you can probably solve all your problems by removing the delays and just having some sort of state machine that changes state after a certain amount of time elapses. It could also check for button presses.

Please post technical questions on the forum, not by personal message. Thanks!

val2 = digitalRead(switchPin); // read the input again to check for bounces val_rev = digitalRead(switchPin2); //REVERSE read input value and store it in val delay(10); // 10 milliseconds is a good amount of time val2_rev = digitalRead(switchPin2); // read the input again to check for bounces val_rev = digitalRead(switchPin2); if (!val_rev) { // make sure we got 2 consistant readings!buttonState_rev = !buttonState_rev ; // save the new state in our variable } if (val == val2) { // make sure we got 2 consistant readings! if (val != buttonState) { // the button state has changed! if (val == LOW) { // check if the button is pressed if (lightMode == 0) { // if its left to right lightMode = 1; // chase left to right then back! } else { if (lightMode == 1) { // if its left to right then back lightMode = 2; // all off } else { if (lightMode == 2) { // if its all off lightMode = 0; } } } } buttonState = val; // save the new state in our variable }

Thanks all for your help. I seemed to have fixed it. Now, I need help with one other thing. I want this to remember which pattern was displayed after it is turned off then back on. Right now, when I start it, it always starts at 0. If I have it in pattern 1 for example, I want to be able to turn it off then when I turn it back on, have it start at pattern 1. I know it has something to do with EEPROM. I read the examples but can't figure out how to add it to my code and get it to actually work. Please help. Thank you!

Do I need EEPROM clear, read, or write? Do I need all of them? Also in the write example, it uses Analog Input 0 which I already have a pot attached to. What do I do with this? I want to store what pattern was last used when the board was turned off then back on again.

int potPin = 0; // input pin for the potint timer = 50; // you can adjust the numbers below to set the max and min for the speed adjustment int x = 10; // sets the max speed (0 = fast) the lower the number the faster it can go int y = 300; // sets the min speed (100 = slow) the higher the number the slower it can go

Maybe I wasn't clear. That was an example of why it would not work. That was why I wanted to see more of your code. Clearly if you read pattern, and then change it later, you may as well not have bothered reading it.

If you post snippets of code, and say the whole thing doesn't work, then we have to guess what else there is that might cause it not to work. That two lines of code was such a guess. Unfortunately you copied my "bad example" into your code.

Please post technical questions on the forum, not by personal message. Thanks!