I have made an irrigation system using Arduino. Timer program is based on comparing the previous Millis() and current Millis(). I want to know the chance for error when the currentMillis() overflows and start from zero after 50 days, while the previous Millis() stored in the variable remains as a larger value.

  • What do you mean with "chance of error"? If you do it like in the BlinkWithoutDelay example the overflow is no problem as long as the time difference between the previous millis() value and the current one stays below the ~50 days, since millis() just cannot count longer.
    – chrisl
    Commented Oct 13, 2021 at 16:05
  • 2
    See How can I handle the millis() rollover?. Commented Oct 13, 2021 at 16:27
  • arduino timekeeping is not accurate if you do not use an RTC module .... it is ok for timing intervals, such as watering every 12 hours ... but it is unable to water at a specific time
    – jsotola
    Commented Oct 13, 2021 at 22:38
  • this may be useful ... github.com/OpenSprinkler
    – jsotola
    Commented Oct 13, 2021 at 22:40


Browse other questions tagged or ask your own question.