This seems to be one of those Give me the code for it to do what I want, I don't want to actually how to code type of posts.In some ways it may appear like that. I've been working on this project for 8 weeks and have built a fine matrix with over 620 led's, had to learn to solder correctly, design circuit boards after learning the software to do that, had to learn about transistors, IC's, power management, resistors, diodes, you name it. I'm studying as fast as I can and have come a long way in those 8 weeks.My back is against the way, I have to get this finished in the next day or two as it's a CHRISTMAS DISPLAY and a present for someone. There's no point in me finishing it in February.
I understand the reasons for "guiding" people and helping them to learn, and I will, but as for this project....... I NEED HELP TODAY
In order to have a responsive momentary switch that changes states you need to have those "states" to run non-blocking code. That typically means no non-trivial delays(), and very limited usage of for/while loops. In the flashSlow() and flashFast() code that you posted, that would mean you would need to redo those functions to not use delays. The blink without delay example shows you how to do just that. Another observation is that in the original code you posted, you run pattern() only during the rising edge once, and and pong all the other times. Assuming pattern() and pong() are non-blocking, you would be better off setting a state variable when you detect the transition. Then outside of the if statements, have your code check the state and run either pattern() or pong() based on its value.
Would you kindly re-write the code for the example LED flash code so that it would switch back and forth when a button is pressed? then I'll have some code to study so as to make the changes to my main code.
set state to 0get the current button stateif the current button state high and the previous one low? is the state 0? set the state to 1 otherwise set the state to 0is the state 0? run non-blocking long blink codeotherwise run non-blocking short blink codeset last button state to current one