stop button

Hi
I make program that works fine but when i press the stop button it does not stops immediately but waits for 4 to 6 seconds and after that stops .It is because i have counters in the program. Please help me to resolve this problem. I attach the program with two comments in it one for stop button and one for one of the modes.
If you do not understand something please write I will explain.
Regards
Riste

FINAL100.ino (8.73 KB)

Hi, Riste, can you post your sketch in the message, this link will show you how.

Please use code tags.. See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

We need to know what all your input and outputs are, and what you are trying to accomplish with your sketch.

Can you please post a copy of your circuit, in CAD or picture of hand drawn circuit in jpg, png or pdf format.

Thanks. Hope to help.

Tom..... :)

Looking at your sketch, you are using delay(5000); in several places.

You probably need to re-code your sketch after understanding how the BinkWithoutDelay example works

See Examples -> 02. Digiital -> BlinkWithoutDelay

You could also use an interrupt but it would be a messy way to do things unless you modified the rest of your code

but when i press the stop button it does not stops immediately but waits for 4 to 6 seconds

It is because you only read the state of the switch now and then.

You need to get rid of EVERY call to delay(). Of course, that means deleting that sketch and starting over. Reading, understanding, and embracing the blink without delay example and some reading about state machines are in your (near) future.