Quote:
Originally Posted by Inetta
okay, I understand how it all works now however I'm not sure how I could write a block of coding that would allow me to toggle the buttons.. if that is possible.
Is there a code that would allow me to just press button = active;
press again = inactive?
|
Well, you need to know some characteristics about these switches.
First off, you will need to probably de-bounce the switches. The chances that you get something like "000000100010101110111111" when the button is pressed are likely. I don't use toggles, so I don't know about code for this. While I could script it up, it would likely be horribly inefficient...
Second, you will need to have a static variable that you set to 1 when the switch is triggered; set it to 0 when the switch goes to 0. Before you set this variable, check if the switch is 1 and the variable is 0; if this condition is true, change the pneumatic, then set the variable to 1.
Let me know if you would like pseudo code, but I'd prefer not to write specific code. That should be left up to you.
JBot