mdillane Posted September 11, 2009 Share Posted September 11, 2009 How would I get variables defined within a sequence in DAQFactory to change their value depending on time? More specifically how would i get a variable to change to 0 at 08:00? thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted September 11, 2009 Share Posted September 11, 2009 8am every day, or just the next 8am? Link to comment Share on other sites More sharing options...
mdillane Posted September 14, 2009 Author Share Posted September 14, 2009 8am everyday please Link to comment Share on other sites More sharing options...
AzeoTech Posted September 14, 2009 Share Posted September 14, 2009 In a sequence: private nexttime = floor(systime() / 86400) * 86400 + 8 * 3600 if (nexttime < systime()) nexttime += 86400 endif while (1) waituntil(nexttime) nexttime += 86400 // do your stuff here endwhile floor(systime()/86400) * 86400 gets you midnight today. Add 8*3600 and you get 8am. Then we check to make sure its not 8am yet, and if it is, we add a day so we wait until tomorrow. The rest is just waiting and looping. Link to comment Share on other sites More sharing options...
mdillane Posted September 15, 2009 Author Share Posted September 15, 2009 Brilliant thanks alot Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.