Odd mills behavior

For the discussion of Arduino related topics.

Moderator: phalanx

Post Reply
messar
Posts: 2
Joined: Thu Oct 18, 2018 6:55 pm

Odd mills behavior

Post by messar » Thu Oct 18, 2018 7:04 pm

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

jremington
Support Volunteer
Posts: 2327
Joined: Fri Jun 15, 2007 9:41 pm
Location: Eugene, Or

Re: Odd mills behavior

Post by jremington » Fri Oct 19, 2018 7:58 am

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

messar
Posts: 2
Joined: Thu Oct 18, 2018 6:55 pm

Re: Odd mills behavior

Post by messar » Fri Oct 19, 2018 8:53 am

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());
}

Post Reply