LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic program with timer

Hi everyone!
I have a program that acquire data from a DAQ, visualize it and write it on file.

I want to control a light with a timer. In this moment I control the light with a push button.

 

I want to start the program, after 8 minutes the light might turn on and the pattern is: 8 minutes of dark, 2 minutes of light, 8 minutes of dark, 2 minutes of light, 8 minutes of dark and then the program will stop.

Any advice?
I attached an image of my program.
Thanks,
Veronica

0 Kudos
Message 1 of 5
(2,537 Views)

You need a couple more shift registers. I'm thinking you could use three. One would contain an enumeration about what state you're in now (light or dark). Another would contain the time at which the current state started, and the third would be a count of how many times you've repeated the cycle. Then it's simply a matter of comparing the current time to the time in which the current state started, and if you've passed the 2 or 8 minute mark, switch to the other state, set the time shift register to the current time, and update the cycle counter.

 

Nathan

0 Kudos
Message 2 of 5
(2,516 Views)

Hi,

thanks for your reply.

I tried to implement your solution (see the attachment) but I had some difficult because I'm a beginner.
Can you explain me how to solve the problem that I highlighted in red?

Thank you so much,
Veronica

0 Kudos
Message 3 of 5
(2,473 Views)

Hi Skeggy,

 

you can try to implement a state machine like the one I attached you in the example.

 

Try to run it. I think it's very easy to understand. I used the Elapsed Time Express VI in order to check if time has elapsed.

 

You can extend the attached code by adding the analog acquisition.

 

I hope it'll help you.

 

Best Regards.

CLA

0 Kudos
Message 4 of 5
(2,453 Views)

I'd do something like this:

timer.png

0 Kudos
Message 5 of 5
(2,434 Views)