02-02-2019 04:48 PM - edited 02-02-2019 05:02 PM
We are attempting to program a double solenoid. Right now we have it that pressing one joystick button extends the cylinder and pressing another joystick button retracts the cylinder. We would prefer that one button press extends the cylinder then pressing the same button a second time retracts the cylinder. Is this possible?
Solved! Go to Solution.
02-02-2019 05:10 PM
That is completely do-able. The way I would do it is download the Memory Library from FRCLabVIEWTutorials.com (https://www.frclabviewtutorials.com/tutorials/memory-library/) and use the button-on-button-off configuration for using both the edge detector and SR Flip Flop (the contents of the library) like this:
(other example on the page).
Team358, also publishes examples of doing this with a feedback node. (http://www.team358.org/files/programming/ControlSystem2015-2019/labview/index.php#ButtonToggleAction)
Personally I prefer the abstraction of the memory library.
02-02-2019 06:54 PM
02-04-2019 08:29 PM
Thanks for the help. We have it working now.
03-07-2019 04:37 PM
We are using this snippet and it works great, so of course now they want more. We actually have this snippet twice for two separate solenoids. Is it possible to have 1 button (4) to activate both solenoids then two separate buttons (5) and (6) to deactivate the solenoids at separate times.
03-07-2019 05:42 PM
@andivwh wrote:
We are using this snippet and it works great, so of course now they want more. We actually have this snippet twice for two separate solenoids. Is it possible to have 1 button (4) to activate both solenoids then two separate buttons (5) and (6) to deactivate the solenoids at separate times.
Yes, this is a use case where the SR Flip Flop is really useful. Something like this should work:
Basically, while the "on button" is pressed, the flip flops are set to True (Set) causing the solenoids to go forward,
but turning off (Resetting) each of their flip flops (and solenoids) is left two additional buttons.
For this example, I opted to set the Enable to true when exactly one of the two inputs are true.
If I were to tie it always true, then pressing both the "on button" and the corresponding "off button" would toggle the output (every time the vi runs until the state is changed). You could use edge detectors to make is such that your driver could still be holding the on button and start pressing the off button and have it work anyways, or you could setup the toggle, or whatever (up to you).