I know the millis() rolls over ever 50 days. Does this library compensate for this or will my program crash? http://playground.arduino.cc/Code/SimpleTimer
The algorithm looks like this: lastMillis = 0 forever do: if (millis() - lastMillis > n) call the particular piece of code lastMillis = millis() end end
Rollover will not be an issue as subtraction is used to determine the time difference: currentTime - previousTime.
If current time is just after rollover, say 0x00000010, and previous time is just before the rollover, 0xFFFFFFF0, then the result is 0x00000020, which is the 0x10 before the rollover and the 0x10 after the rollover.
Try it in your calculator, you will get a result (in Windows) of 0xFFFFFFFF00000020. Keep only the lower 32 bits, as time variables are unsigned long, or 32 bits, and the result is 0x00000020.