LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

hardware button

Goodday everyone,

I have to implement a hardware button to my program using the call library function node.

This VI is a trafficlight. The user can fill in the value of how long the lights has to be turned on. 

If i push a button it has to go to the next case, this case will let the orange light blink. When the button is pushed again, it goes back to the normal sequence.

Now i have a printed circuit board with those leds and a button. In the software VI everything works. I only need to implement my hardware push button yet. but i can't really manage to make that work. 

any help?

 

(The button function in the call library node is DCD)

Download All
0 Kudos
Message 1 of 14
(4,249 Views)

What traffic light system uses orange lights and not yellow?

 

I see a major issue with your VI.  It doesn't have a while loop so it actually only runs once.  Please don't say you are using the Run Continuously button which is only meant for debugging subVI's.

 

Your DLL call for checking the status of the hardware button belongs in a loop.  Use the Boolean Crossing Pt by Pt to detect when the value from that goes from False to True.  That will drive a change in state of the boolean used to determine whether the blink the yellow light or execute normal light operation.  The boolean that value that drives that cases structure belongs in a shift register. The output of the Boolean crossing will feed an XOR on that boolean, so whenever the button is pressed, it flips the state of the boolean.

 

0 Kudos
Message 2 of 14
(4,216 Views)

 


@RavensFan wrote:

What traffic light system uses orange lights and not yellow?

 

I see a major issue with your VI.  It doesn't have a while loop so it actually only runs once.  Please don't say you are using the Run Continuously button which is only meant for debugging subVI's.

 

Your DLL call for checking the status of the hardware button belongs in a loop.  Use the Boolean Crossing Pt by Pt to detect when the value from that goes from False to True.  That will drive a change in state of the boolean used to determine whether the blink the yellow light or execute normal light operation.  The boolean that value that drives that cases structure belongs in a shift register. The output of the Boolean crossing will feed an XOR on that boolean, so whenever the button is pressed, it flips the state of the boolean.

 


Hello,

Thank you for your help!

1 issue yet:

how can i solve this? (see attachment) i just used an enum constant and wrote false-true in it...

0 Kudos
Message 3 of 14
(4,146 Views)

@sadiek wrote:

 1 issue yet:

how can i solve this? (see attachment) i just used an enum constant and wrote false-true in it...


You don't understand how the Point-by-Point Boolean Crossing Function works.  Right-click it, choose Help, and read the detailed Help documentation.  The Enum is part of the Function -- you cannot change its definition without breaking the Function!  This Function can work in three ways -- either signalling when the input goes from False to True, from True to False, or in Either direction, as dictated by the Enum.

 

This Function is actually a little sub-VI.  Go ahead and double-click it -- you'll see how it works, what the Enum does, and so on.  If you've "messed it up" by redefining it in your code, all is not lost -- delete the Enum that you show as circled in your picture, right-click the input to the PtbyPt function where it belongs, and choose "Create Constant".  You'll get the Enum back, with its default value of "Either".  Use the little triangle to expand it and choose the Enum value you want.  Fixed!!

 

Bob Schor

0 Kudos
Message 4 of 14
(4,140 Views)

@sadiek wrote:

 1 issue yet:

how can i solve this? (see attachment) i just used an enum constant and wrote false-true in it...


You can't just create the enum constant yourself.  You probably have an enum that doesn't have all the items defined the same way that the subVI expects them.  You then get a broken wire because the enum definitions are different

 

You need to right click on the input to that Boolean Crossing subVI and choose Create Constant.  Then select the False-True item.

0 Kudos
Message 5 of 14
(4,135 Views)

Not sure what im doing wrong, can't seem to get it working yet.

Can anyone help me out?

0 Kudos
Message 6 of 14
(4,126 Views)

You seem to ignore all the advice given. For example, there is still no while loop.

Also wiring a scalar boolean to a DBL array seems pointless.

 

Make a proper state machine (look it up!) and place the indicators after the case structure. No local variables needed.

0 Kudos
Message 7 of 14
(4,124 Views)

@altenbach wrote:

You seem to ignore all the advice given. For example, there is still no while loop.

Also wiring a scalar boolean to a DBL array seems pointless.

 

Make a proper state machine (look it up!) and place the indicators after the case structure. No local variables needed.


Excuse me i uploaded the previous version,

this is the right version

0 Kudos
Message 8 of 14
(4,120 Views)

How is it not working?  "Can't get it working yet" doesn't tell us anything.  In what way is it still not working?

0 Kudos
Message 9 of 14
(4,108 Views)

@RavensFan wrote:

How is it not working?  "Can't get it working yet" doesn't tell us anything.  In what way is it still not working?


It starts blinking black without any error message , see attached screenshot

0 Kudos
Message 10 of 14
(4,084 Views)