01-25-2013 08:02 AM
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
01-25-2013 01:05 PM
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
01-28-2013 03:39 AM
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
01-28-2013 10:49 AM
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
01-28-2013 01:34 PM
I'd do something like this: