I am working on a program that triggers a relay on/off and logs data.
The user enters two items: duration and delay.
I am using a QMH design for this program. What I have currently done is create a flat sequence that turns the relay on, waits a certain amount of time in ms (duration), then closes it. I then send a 'Start' message to the acquisition and logging queues.
Where I am lost is how to stop the logging and acquisition after a certain amount of time has passed. It is imperative that data logging begins right after the relay closes.
For instance, if a user enters 1000ms for the delay, I should, after the 1000ms, see 1000 samples in the log file (1 each 1ms)
What is the best way to ensure this happens?