The Planted Tank Forum - View Single Post - Hunter X's Arduino Whole Tank Controller (52K Warning)
View Single Post
Old 04-09-2014, 05:19 AM   #169
benjaf
Algae Grower
 
benjaf's Avatar
 
PTrader: (0/0%)
Join Date: Mar 2012
Location: Denmark
Posts: 105
Default

Quote:
Originally Posted by bigd603 View Post
I want the arduino to to feed the data to Xively every ten seconds without using a delay command so the rest of the sketch doesn't get held up in the mean time. I'm using the millis method from the Blink Without Delay example. It works well for a while, but after several hours it stops the feed until i reset the Arduino. I think it has something to do with the millis crossing over, but I don't really know how to fix it. Anyone have any ideas?
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:
Code:
 
if (currentMillis - lastXivelyPut > putInterval) 
{ ... }
else if(currentMillis < lastXivelyPut) {
lastXivelyPut = 0;
}
__________________
benjaf is offline   Reply With Quote