04-22-2017 08:24 AM
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)
04-22-2017 10:48 AM - edited 04-22-2017 10:49 AM
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.
04-23-2017 05:28 AM
@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...
04-23-2017 08:53 AM
@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
04-23-2017 10:21 AM
@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.
04-23-2017 12:26 PM
Not sure what im doing wrong, can't seem to get it working yet.
Can anyone help me out?
04-23-2017 12:40 PM
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.
04-23-2017 12:53 PM
@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
04-23-2017 04:14 PM
How is it not working? "Can't get it working yet" doesn't tell us anything. In what way is it still not working?
04-24-2017 12:29 PM
@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