LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Blinking LED case structure

Hello.

 

I am currently making a simulation for a train journey as part of my project. I have it working how I want it (for now) but as an extra thing I am trying to include is getting my 'directional' LEDs to blink. At the moment I have a shift register and the local variable of the LED in a forever loop in the case structure, which does make the LED that I want to blink. However I want this to stop when the next case is selected, as at the moment it carries on forever and does not stop. If anyone could spare some knowledge I would be very grateful!

 

I've attached my VI as well.

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

You have some serious architectural problems. Your inner "blink loops" will block iteration of the outer loop. The outer loop cannot go to the next iteration unless the current blink loop is stopped.

 

I would also remove all the local variables. There are way too many instances scattered all over the various cases. All you need is to place the indicators after the case structure and wire from the appropriate diagram constants inside the loop.

 

You have a 1250 ms dealy in the outer loop, but also an event structure with a 5000ms timeout. unless some other event occurs, the 5000ms will win, unless the code is trapped inside an inner loop which takes forever and both will lose! 😮

 

As a first step I would remove all the visa stuff and operate it directly from the front panel to investigate program logic and flow. You can add it back later once the code is running well.

 

I would place the event structure in its own seperate loop, delete all the current inner loops and use the current outer loop for blinking. See how far you get.

0 Kudos
Message 2 of 8
(6,029 Views)

Getox, 

 

While I haven't fixed your code, I have included a VI with some very simple code that will change the state of a boolean indicator at a rate that is a function of the calling loop's period.  You can extend this to your architecture without using the blocking loops that altenbach mentions.

 

Good luck!

 

Wes

 


--------------------------------------------------------------------------------------
Wes Ramm, Cyth UK
CLD, CPLI
0 Kudos
Message 3 of 8
(6,022 Views)

Hello

 

i have a problem with my VI

i am using case structure to blink and LED.

and attached a boolean to the outer so that when 

i press, the led is light up

But now i dont want the led to blink. I want it to stay light for some time..

 

How to do it.?

 

0 Kudos
Message 4 of 8
(4,714 Views)

Hello!

 

If you look at the example I have attached (which must be run inside a loop somewhere so that you can use the iteration terminal), the divisors are front panel controls.

 

You could just as easily make the divisors be the result of some other logic on your block diagram that controls after how many loops your turn the LED on. 

 

Send me a PM and we'll knock together a sample VI illustrating the concept if you need some assistance.

 

Wes

 


--------------------------------------------------------------------------------------
Wes Ramm, Cyth UK
CLD, CPLI
0 Kudos
Message 5 of 8
(4,709 Views)

Dear Sir

I am sharing part of my VI

the concept of this subtitle of this discussion, i want to use it in my VI. this is why i am asking question.

 

Sir it is like if the data is equal to the constant i put, then it will go to the case structure when the number 3 ( is the pin 3 where the led is on my breadboard).

 

i want to add somthing in the case structure that it kept the led light up still instead of blinking.

i did try to use loop , it does not work. even i try wait also. it does not work

0 Kudos
Message 6 of 8
(4,703 Views)

i dont want my led to blink... in my program i want my led to glow for lets say 3-5 sec. when it is true n den led should not glow when my statement is false?????/

i m not getting solution of this so plz if u can den help me to solve dis query....... plz rply asap

0 Kudos
Message 7 of 8
(3,861 Views)

Hi thakurshubh,

 

i dont want my led to blink..

Then why do you post in this thread? Why don't you create your own thread?

 

to glow for lets say 3-5 sec

Learn to use the ElapsedTime expressVI…

 

plz rply asap

Why you are in such a hurry?

Btw. read this!

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 8 of 8
(3,853 Views)