Odd mills behavior

I am working with a nRF52832 breakout board, and trying to use mills() to time a 30 minute event. Surprisingly, I looks like I’m running into some type of rollover at 512 seconds.

The following code:

#include <Wire.h>
void setup()
{
Serial.begin(9600);
Wire.begin();
}
void loop() 
{ 
  Serial.println(millis())
}

GIves this every time I run. (abbreviated)

511974
511983
511991
511999
8
11
15
19
23

Any help would be appreciated on what needs to change to avoid this.

Thanks,

matt

That code won’t compile, so it isn’t what you were running.

Hi,

Thanks for catching the error - missing a ;

Here is the corrected code:

#include <Wire.h>
void setup()
{
Serial.begin(9600);
Wire.begin();
}
void loop() 
{ 
  Serial.println(millis());
}