From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[Beginner] Boolean leds are not blinking 'separately'

Solved!
Go to solution

I have attached a picture of a section of my code

 

2 buttons on the left (Status 1 and Status 2)

 

Other sections control the Numeric part, when set to 3 I want the LED (Alarm 1/2) to blink every 250ms, when set to 2 I want it to blink every 1000ms

 

I believe this is the appropriate way of doing this, (if there is a better method, please let me know too)

 

However the problem.......

 

When Numeric 1 is set to 3, the LED (Alarm 1) is blinking every 250ms. (As I want it to)

HOWEVER, when Numeric 2 is set to '2', the LED (Alarm 2) is blinking every 1000ms, AND Alarm 1 is ALSO blinking at 1000ms.

 

I don't understand why. I've changed a lot of sections to test if any of the other parts of the vi is affecting it but I don't believe so.

 

Thanks in advance

0 Kudos
Message 1 of 2
(2,166 Views)
Solution
Accepted by topic author Jbiem

@Jbiem wrote:

I have attached a picture of a section of my code


Please attach the actual VI instead. We cannot debug pictures. We cannot see the other cases, we can't even see most terminals.

 

In any case, the code looks completely "inside-out". Why is there no outer loop? Why do you need all these local variables? You are also doing equal comparisons on floating point values, whcih is generally not a good idea. Why all the coercion dots? How do the inner loops ever complete? Why all the duplicate code? The only thing different between the mutually exclusive cases is a single diagram constant, so why duplicate all the rest of the inner code?

 

All you need is a single outer while loop running at 250ms, then do a little logic to blink the LEDs as needed.

0 Kudos
Message 2 of 2
(2,154 Views)