From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

How to on a switch for 5seconds and then off?

Is it possible to on a switch for 5 seconds and then off? The switch is controlled from myRIO on Ni data dashboard.

0 Kudos
Message 1 of 12
(3,835 Views)

Hi JiaLuo,

 

Is it possible to on a switch for 5 seconds and then off?

Yes.

 

Spoiler
As a switch is a control you need to use a local variable of that control. Set it to TRUE, then wait for 5s, then set it to FALSE.

What exactly is your problem? Where are you stuck? How does your VI look like? (And please attach code (aka VIs or snippets) instead of pure images…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(3,809 Views)

Hi GerdW! Here's the program.

0 Kudos
Message 3 of 12
(3,806 Views)

Hi JiaLuo,

 

no, there is no "program"! All I see is the LabVIEW project file, which is "just" a description of the VIs contained in your project! (Hint: open the lvproj file using a text editor…)

 

To repeat: Please attach code aka VIs or snippets!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 12
(3,804 Views)

projct file.JPG

Hi JiaLuo,

This is what i saw. Cannot open vi

 

 

Best Regards,
Dhans 😉
Kudos are welcome 😉
Aspirant Labview Programmer (Labview 14) 😉
0 Kudos
Message 5 of 12
(3,769 Views)

Hi! Here's the program. Thanks alot.

0 Kudos
Message 6 of 12
(3,767 Views)

Hi JiaLuo,

 

I'm sorry, but that's a huge mess with a lot of boolean indicators. And even more local variables in a huge BD without any (recognzable) program structure…

 

How should we help you when we don't know what you are talking about?

Which switch should be switched?

 

Clean up your BD.

Replace locals by wires.

Use some meaningful program structure.

Use descriptive labels for controls/indicators!

Then ask again…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 12
(3,760 Views)

Hi, sorry about vague info given. I've attached an example, I'm trying to control the switch such that, it was in the initial state (off). When i switch it to on, the LED will on only for 5 seconds and then turns off automatically, and when it changes state again the same process will occur again; on LED for 5 seconds and turns off.

0 Kudos
Message 8 of 12
(3,738 Views)

Hi JiaLuo,

 

When i switch it to on, the LED will on only for 5 seconds and then turns off automatically, and when it changes state again the same process will occur again; on LED for 5 seconds and turns off.

When you have problems to implement such a basic wait statement:

check.png

I really advise you to take those FREE online training resources to learn LabVIEW!

 

Still I would recommend to use some better programming schemes in favor of the sequence inside the case structure. Use statemachines or maybe queue-driven message handlers…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 12
(3,721 Views)

Hi GerdW, could u save it as 2014 or earlier versions? because i'm using the LV2014 version n can't open it. Thanks!

0 Kudos
Message 10 of 12
(3,685 Views)