Serial.print problems

Hello all

I'm struggling a bit to get a large number to compile in Serial.print. I have a value which has been declared as unsigned long long (I'm measuring a long process in milliseconds which can run for weeks). If I do Serial.print((long)value), it compiles fine. If I do Serial.print((long long)value) or Serial.print((long long unsigned)value it comes up with the "error: call of overloaded 'print(long long unsigned int)' is ambiguous". Looked for any references to this, without success. I'm using Nick Gammon's Robot Racer example Gammon Forum : Electronics : Microprocessors : Interrupts , but with longer times. Essentially, I'm trying to capture a train of pulses 10mS ON 10mS OFF which might run for several hours, then not re-occur for weeks or months. If anyone has done anything similar or my formatting is wrong or it is simply not possible, I would be grateful to hear. I don't actually need to know how long the individual pulses are, just what the duration of the train is.

Thanks

Hi tigger

Take a look at this thread:

http://forum.arduino.cc/index.php/topic,58697.0.html

Looks like "long long" will compile but print does not work correctly with it. The thread includes a workaround.

All the best

Ray

I'm measuring a long process in milliseconds which can run for weeks

You can measure up to seven weeks without resorting to 64 bit.

AWOL:

I'm measuring a long process in milliseconds which can run for weeks

You can measure up to seven weeks without resorting to 64 bit.

and you can measure a virtually infinite length of time if you break your time into multiple values... every day (after 86400000 ms have passed) increment a day counter and reset the millis counter to 0. You can then measure up to 4294967296 days, or 11.7 million years.