Flowcode and switch inputs
Flowcode and switch inputs
I am new to Flowcode and was trying to figure out how to utilize many switch inputs without the program repeating the input with the switches closed. Some examples would be appreciated.
Re: Flowcode and switch inputs
I have eight or more switch inputs. When I press a input switch everything is fine if the switch is pressed only momentarily, but if for some reason the switch gets stuck the program sees it as multiple switch presses by means of the program loop. I would like when the switches are pressed, no matter how long, it will represent only one press.
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: Flowcode and switch inputs
Ok, I understand.
You essentially need to wait until the switch has gone down and then gone up again to register a switch click. So, if the switch input has gone high you need to wait until it has gone low again.
Of course, there are issue with switch "bouncing" - I think this has been dealt with in other threads.
It may not be apropriate for your program to wait until the input has gone low, so you could create a counter that increments around the loop and only registers the button press once the counter has increased a number of times since it the button was initially pressed.
I hope this helps a little.
You essentially need to wait until the switch has gone down and then gone up again to register a switch click. So, if the switch input has gone high you need to wait until it has gone low again.
Of course, there are issue with switch "bouncing" - I think this has been dealt with in other threads.
It may not be apropriate for your program to wait until the input has gone low, so you could create a counter that increments around the loop and only registers the button press once the counter has increased a number of times since it the button was initially pressed.
I hope this helps a little.