LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LED glow and off for certain time

Solved!
Go to solution

Hi, 

I am working on a project where I receive a string of numbers continuously from Arduino via com port using Visa. I've converted the string into a 2D array of 5 columns (5 different data) and n number of rows which gets updated continuously as long as i run the program.

have a look at the below array (example),

array.JPG

 

whenever the value of the 4th column is 23, i need to make a LED glow for 5 iteration regardless of the value in 4th column. problem is, i am able to make the LED glow for only the iteration where the value is 23. but, as soon as the value changes to 41, my LED is turned OFF.  

can anyone tell me how to program this??

thanks in advance.

 

0 Kudos
Message 1 of 5
(1,289 Views)
Solution
Accepted by VigViv

Hi VigViv,

 


@VigViv wrote:

whenever the value of the 4th column is 23, i need to make a LED glow for 5 iteration regardless of the value in 4th column. problem is, i am able to make the LED glow for only the iteration where the value is 23. but, as soon as the value changes to 41, my LED is turned OFF.


  • To store data for next iterations you should use a shift register.
  • Whenever the condition (value==23) is met you store a "5" into the shift register.
  • When the value in the shift register is >0 you set the LED to TRUE.
  • At the start of the next iteration you decrement the value of the shift register by one, followed by MinMax with 0 to keep it at 0.

Now your LED will be TRUE for 5 iterations…

 

I prepared an example for you:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(1,277 Views)

Hi GerdW,

 

Thanks for the reply. The concept is working. However, I'm not sure of the purpose of the icon (which has jars inside) after decrement and I have not used it in my program. kindly bear with me as I'm a beginner. 

Also, I'm not using timer function in my while loop as it will delay my entire measurement and plotting of graph. 

 

In the end, I have what I needed. thank you once again!

 

regards,

Vigviv

0 Kudos
Message 3 of 5
(1,251 Views)

Hi VigViv,

 


@VigViv wrote:

However, I'm not sure of the purpose of the icon (which has jars inside) after decrement and I have not used it in my program. kindly bear with me as I'm a beginner. 

Also, I'm not using timer function in my while loop as it will delay my entire measurement and plotting of graph.


That function is found in the comparison palette - read its help.

The Wait was used just for demonstration purposes: the examples should make sense as is and so allows the user to actually "see" the "LED glow". Without this wait it would iterate so fast you couldn't see the LED blink…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(1,240 Views)

Hi GerdW,

 

Got it! thank you.

 

Regards,

VigViv

0 Kudos
Message 5 of 5
(1,185 Views)