Hello,
I'm a bit of an arduino & programming noob. I did some searching on the forum and with google, but I don't think I can put my question/situation in good enough terms for a search engine, so here I am.
I'm using the code from here - http://arduino.cc/en/Tutorial/PachubeClient - with some minor, I think, modifications. Basically, I've commented out the DHCP part, and am using a static ip.
Everything works fine, but I don't need updates every 10 seconds, as this line does
const unsigned long postingInterval = 10*1000; //delay between updates to Cosm.com
So I changed it to const unsigned long postingInterval = 60*1000; //delay between updates to Cosm.com
to give a one minute (60 * 1000 millis = 60,000 millis, right?) delay, but it doesn't work.
So, I added some debugging lines serialprint(postingInterval);
and found that the value of 'postingInterval' was 4,294,941,790, not 60,000. Hmmm, that's roughly 2^32 which is the storage space for the 'long' data type, so I thought I'd try some other values.
Any integer up to 32 const unsigned long postingInterval = 32*1000;
would give an expected value (for 32, 32000), but an integer of 33 or greater returned that 2^32 value.
Trying decimal numbers, 32.999 returned 32999 and 32.999999 returned 33000.
Well, how about trying? const unsigned long postingInterval = 60000;
That works fine; returns 60000, and gives me my 1 minute update, so everything is going well.
Except, I don't know what's caused this error.
I'm not looking for a handout here, but if someone can steer me in the general direction so I can figure out what's going on, I'd appreciate it.
I ran across something that seems similar to this years ago when I was working on my Master's thesis (Civil Engineering), and I had written a little program in FORTRAN, and was getting different results depending on whether I had a debugging line or not. At that time, it was apparently due whether the value had been placed in memory or not; I can't recall for sure.
I have to say, though, that programming with concrete is a little easier than FORTRAN...
Thanks