Having difficulty with subtration of unsigned long

  • Use unsigned long for time variables.
  • Use unsigned byte or unsigned int or unsigned long for required time duration
  • Place current time or elapsed time on the left and time duration on the right side of the comparison operators.

Then there'll be no rollover issue.

if (currentMillis - previousMillis) >= NextBlinkOn {
  // your code
}

EDIT: see reply #59 for update.