using Multiple Buttons

I have a program that flashes Leds on Outputs 11 - 13 in specific pattern with Button Inputs on Digital
2 and 3.

The default delay is set to 20 milliseconds.
Button attached to Input 3 works as expected In the while loop, there is if else condition - Button is High run coded pattern with 20 millsecond delay or Button low run the coded patterns. The Code finishes each if Button is High or Low pattern, and reads the button state again to determine what to do.

I tried to use Velleman Capacitive touch switch VMA 305. Either of the 2 switches seem to work.

I might have reversed the wiring on them. I am not sure they are toasted because of that. If any one has any experience with these switches. Let me know if how you wired them up. I wired up the switches to the following picture - VMA305 Wiring Picture

I am trying to add three things to this program.

1.) I am looking for Button to be used as while loop exit condition - stop.

2.) I am looking to use another method which is TBD that change the delay time as variable. I am considering a keypad entry system to set the delay time from 100 milli secs to 20 seconds.

3.) I am looking to set a variable for the delay such that I can automatically decrease the delay from 100 milliseconds to 20 milliseconds over a set start up time.

Any assistance I can get would be greatly appreciated.

Thank you.

Test_3_LEDS_Fast_SLow_Rate_1Button_Exit_2Button.ino (3.5 KB)

Either the code or the comment is wrong

delay(20);                  // waits for a second

If you want a responsive program you should not use delay() as it blocks the Arduino from doing other things. Have a look at how millis() is used to manage timing without blocking in Several Things at a Time.

And see Using millis() for timing. A beginners guide if you need more explanation.

...R