LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Blinking LEDs in different mods

Hello everybody,

 

I checked several posts in regard to LEDs blinking but I couldnt find any which help me with this specific problem. I made a VI with five LEDs blinking when the Start Button is pushed. Further it counts the loops and it is possible to change the delay (faster/slower blinking), while the VI is running. A Stop Button ends the loop.

 

Now I would like to implement different blinking modes of the LEDs. For now they are blinking all simultaneously. I would like to add a sequential blinking and the first LED to blink 5 sec and then the next one to blink 5 sec and then the next one and so on. Therefor I added a "Text Ring" and tried to somehow solve this problem. Unfortunately without any succes. Is there someone who can help me with this?

 

Thank you in advance!

0 Kudos
Message 1 of 9
(3,355 Views)

I could not view your VI because I'm using an older version of LabVIEW, but here are my thoughts.

 

First, the functionality sounds a little odd. Perhaps you could mention a little why you want this to happen and maybe there is a better or more intuitive UI design.

 

If this is the way it must be, then you should use some variation of a state machine.  You will get the hang of it quickly, as you just move from state to state based on conditions that you have checked.

0 Kudos
Message 2 of 9
(3,343 Views)

Thank you for the quick answer gregoryj.

 

I am going to read some more about state machine and try it again. The task was given to us by our Prof. I guess it is just an invented task for us to get familiar with LabVIEW.

 

I even think that I used the state machine "feature" but I'm not sure. Anybody else who can help?

0 Kudos
Message 3 of 9
(3,338 Views)

I see. As a little more guidance, you will want to create an "enum" with the names of your states in them. It is a good idea to right-click this and "make type def". This will allow you to add more states to the type def and have it update all around your program.

 

Store a time in the shift register (I'm sure the "tick count (ms)" will be accurate enough). Then when you are in state 1, check to see if the current time is greater than the stored time + 5000ms. If it is, then go on to state 2, otherwise, stay in state 1.

0 Kudos
Message 4 of 9
(3,327 Views)

Thank you very much gregoryj. I think I understood how to switch between states with using the "tick count" for example.

 

But how to control the LEDs so that they blink in sequence or blink for 5 seconds and then switcht to the next one. I mean how to even create the different states/mods?

 

I attached a jpeg just for you to see how I built up my VI so far.

0 Kudos
Message 5 of 9
(3,319 Views)

You are getting there, but the case selector should be the enum, not your start button. Also, there is a "blinking" property node that you can set for the LEDs.

0 Kudos
Message 6 of 9
(3,315 Views)

Thanks a lot for your guidance and help. Now it is time to work with it 🙂

0 Kudos
Message 7 of 9
(3,308 Views)

Here is an example for a single LED. You will have to expand it to work in different modes (I suggest extra states!) and for multiple LEDs. You will notice that I did not use a type-def, so when you add more states all of the other places that enum appears are "old". Consider that a free lesson!

 

Blink LED.png

0 Kudos
Message 8 of 9
(3,303 Views)

Hi gregoryj,

 

today we got an example on how the task can be solved. Using a case structure with an enum to choose between the mods was absolutely the right way. In addition it would had been easier to directly use an array for the leds instead of single leds. I have attached a picture of one mod for you to see.

 

Once again, thank you very much for your help. I appreciate the free lesson 🙂

 

 

0 Kudos
Message 9 of 9
(3,257 Views)