Page 1 of 1

Odd mills behavior

Posted: Thu Oct 18, 2018 7:04 pm
by messar
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:
Code: Select all
#include <Wire.h>
void setup()
{
Serial.begin(9600);
Wire.begin();
}
void loop() 
{ 
  Serial.println(millis())
}
GIves this every time I run. (abbreviated)
Code: Select all
511974
511983
511991
511999
8
11
15
19
23
Any help would be appreciated on what needs to change to avoid this.
Thanks,

matt

Re: Odd mills behavior

Posted: Fri Oct 19, 2018 7:58 am
by jremington
That code won't compile, so it isn't what you were running.

Re: Odd mills behavior

Posted: Fri Oct 19, 2018 8:53 am
by messar
Hi,
Thanks for catching the error - missing a ;

Here is the corrected code:
Code: Select all
#include <Wire.h>
void setup()
{
Serial.begin(9600);
Wire.begin();
}
void loop() 
{ 
  Serial.println(millis());
}