FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Double solenoid

Solved!
Go to solution

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? 

0 Kudos
Message 1 of 6
(4,599 Views)
Solution
Accepted by topic author andivwh

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:

buttonOnButtonOff.png

(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.

 

 

0 Kudos
Message 2 of 6
(4,589 Views)

Here is the simplest way that I know of to create a toggle output.

toggle.png

Champion CLA

Making senseless computers do
intelligent real world things
is NOT easy. SO MAKE IT FUN!
0 Kudos
Message 3 of 6
(4,574 Views)

Thanks for the help. We have it working now.

0 Kudos
Message 4 of 6
(4,542 Views)

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.

0 Kudos
Message 5 of 6
(4,414 Views)

@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:multiButtonExample.png

 

 

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).

0 Kudos
Message 6 of 6
(4,412 Views)