LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

hardware button

See the red block around that subVI?  That means you set a breakpoint on it.  Go to View >> Breakpoint manager, or use Shift Right click on the block diagram and pick the breakpoint cursor to clear it.

0 Kudos
Message 11 of 14
(678 Views)

ok that is solved. but it still doesn't work. The vi won't switch to the yellow blinking state when the function call library node button is pressed.

also the program reads the button only when it finishes a sequence loop. it should read the state continiously.

0 Kudos
Message 12 of 14
(674 Views)

That's because you have a timing problem.  Your loop iteration takes too long.  I bet if you held down the button long enough that the loop gets to iterate again so that it can read the dll, you'd see it would work.

 

There are two fixes.

 

1.  As mentioned by others before, turn this into a proper state machine, one that the loop iterates quickly so that it can detect the button press.  A state to change to each color, a state to turn it off (for the yellow blink), and a state that checks if the required time has passed that can also check to see if the button has been pressed.

 

2.  Move the button check to another loop that runs quickly, use a notifier or queue to pass a message to your current main loop whenever it detects the button has been pressed.

 

#1 is really the best solution, especially for long term expandability.  But #2 will do the job with less code modification.

0 Kudos
Message 13 of 14
(669 Views)

@RavensFan wrote:

That's because you have a timing problem.  Your loop iteration takes too long.  I bet if you held down the button long enough that the loop gets to iterate again so that it can read the dll, you'd see it would work.

 

There are two fixes.

 

1.  As mentioned by others before, turn this into a proper state machine, one that the loop iterates quickly so that it can detect the button press.  A state to change to each color, a state to turn it off (for the yellow blink), and a state that checks if the required time has passed that can also check to see if the button has been pressed.

 

2.  Move the button check to another loop that runs quickly, use a notifier or queue to pass a message to your current main loop whenever it detects the button has been pressed.

 

#1 is really the best solution, especially for long term expandability.  But #2 will do the job with less code modification.


first of all im not sure how to program these solutions, little more help?

Second of all im not sure it will fix the problem. Because indeed when i hold the button i can see its reading the button eventually but it doesnt switch the case.

0 Kudos
Message 14 of 14
(649 Views)