Controlling LED Patterns using Switchbank
Posted: Wed Jan 18, 2012 7:16 pm
Hello,
I'm working on a project that shows three LED Array patterns depending on which button you push (one pattern per button for the Switchbank). The pattern should change each time you push a different button. I am able to show the correct pattern for the corresponding button when I first push a button. When I try to push another button, the pattern doesn't change to a new one. Basically, the state of the switchbank is retained (1 if you push the right most; 2 if you push the middle, 4 is you push the last on the left) and doesn't change even when you push another one. I think the key is to get out of the loop for the pattern so that the program lets you push another button and display a new pattern. I just don't know how to do that or where to go next. The variable I set for this is 'push'.
Also, when the pattern is running and you push another button, the new pattern must start at the LED where the button was pushed and the pattern was interrupted (say a new button was pushed and the pattern was interrupted at LED5, the new pattern must start at LED5). The variable I used for the LED Array is 'led'.
Can you guys help me, please?
--choy
I'm working on a project that shows three LED Array patterns depending on which button you push (one pattern per button for the Switchbank). The pattern should change each time you push a different button. I am able to show the correct pattern for the corresponding button when I first push a button. When I try to push another button, the pattern doesn't change to a new one. Basically, the state of the switchbank is retained (1 if you push the right most; 2 if you push the middle, 4 is you push the last on the left) and doesn't change even when you push another one. I think the key is to get out of the loop for the pattern so that the program lets you push another button and display a new pattern. I just don't know how to do that or where to go next. The variable I set for this is 'push'.
Also, when the pattern is running and you push another button, the new pattern must start at the LED where the button was pushed and the pattern was interrupted (say a new button was pushed and the pattern was interrupted at LED5, the new pattern must start at LED5). The variable I used for the LED Array is 'led'.
Can you guys help me, please?
--choy