I am using the millis function as timer instead of using delay. It's mentioned on the reference page that the number of milliseconds will overflow after approximately 50 days.
What will happen when it overflows if I use the following: http://arduino.cc/en/Tutorial/BlinkWithoutDelay
Just skip one interval and go on afterwards ?
So like I said it's gonna roll over and start from the beginning, right ?
It will just skip one interval (as previousMillis will be higher than currentMillis) and go on afterwards.
no, millis will start at 0 and the subtraction construct will cause an underflow to correct all things nicely.
if(currentMillis - previousMillis > interval) {
assume millis can only go from 0..9 and interval = 3 and previous millis is 7
millis previous
7 - 7 = 0 so not > 3
8 - 7 = 1 so not > 3
9 - 7 = 2 so not > 3
0 - 7 = 3 so not > 3
1 - 7 = 4 !! > 3 so do the if (set new previous)
2 - 1 = 1 so not > 3
3 -1
4 -1
5 -1 !! bingo again