FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Button Push on/off

I'm working in LabView and I'm tryng to do a simple function button push latch.

Push button and release turns a solenoid on, push and release button a second time to turn off.

I found an example on the ni.com/first web site (search for Button Functional) that has 4 different type of button functions.  I'm trying to use the on/off case in the example.  What I don't understand is, what keeps the case structure that is enabled by the deracing button AND gate in the "True" case?  I would think the AND output is only true for one processing loop (30ms???).

0 Kudos
Message 1 of 6
(8,860 Views)

What you need to do is to detect a rising edge of the button. Going False to True.

Then invert the state of a boolean that is the state of the solenoid.

The state of the solenoid is stored in a non initialize shift registers of a loop that runs only once (a For Loop or a While Loop will work)

Or in a Feed Back node

Download All
0 Kudos
Message 2 of 6
(4,113 Views)

You're right - it looks to me like that example doesn't do what it says it does.  You could add an additional shift register to keep track of whether the current state is On or Off, and then XOR that with the output of the AND to get the behavior your want.

0 Kudos
Message 3 of 6
(4,113 Views)

Thank you very much for confirming that I'm not going total crazy, yet!  You would not believe how many hours I wasted trying to figure out how it would do what it said it should do.  I hope that the wonderful folks at NI always verify their examples work before posting them!

OmarGator, Thanks for your much simpler way of doing a buttom latch.

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

A very small style note: consider using XOR instead of the select.

XOR.png

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

so..how to interface the solenoid valve to daq ni usb 6008

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