The Planted Tank Forum - View Single Post - Hunter X's Arduino Whole Tank Controller (52K Warning)
View Single Post
post #170 of (permalink) Old 04-09-2014, 05:20 AM
Planted Member
Join Date: May 2011
Location: Portland, OR
Posts: 286
Originally Posted by benjaf View Post
Nice to see someone is making progress!
Any particular reason for using millis rather than a timestamp from the RTC? If you do want to use millis you will have to handle rollover. That could be done with something like this:
if (currentMillis - lastXivelyPut > putInterval) 
{ ... }
else if(currentMillis < lastXivelyPut) {
lastXivelyPut = 0;
Thanks Benjaf, I didn't do the RTC time stamp at first because I was also worried about a rollover scenario (if it checked if lastXivelyPut >= second() + 9 or something like that) when the second rolled over into the next minute. But thinking about it, I could just have it check if second = 0, 10, 20, 30, 40, or 50. That would give me the same result without worrying about a rollover. Thanks!
bigd603 is offline  
For the best viewing experience please update your browser to Google Chrome