Loop between a date of every month,

void function() {
  static byte prev_day; //static variable retains its value between calls to function()
  const byte set_day = 4;
  byte new_day = getadatefromNTPserver //the day will be receieved from the ntp server and for a whole24 hours the state will remain the same.
  if ((new_day != prev_day) && (new_day == set_day)) {
    //this only runs on set_day, when the day changes from the previous day
    //reset loop
  } else {
    //do stuff
  }
  prev_day = new_day;
}
1 Like