Programmed device restarting after uploading code

I think you have to do it yourself and be better thu that trial-and-error process of learning / coding.
We can only give some suggestions based on what you’ve done to give you some kind of pointer and guide you.

This is some pointer for you to start the work, based on the project

to calculate RainFall in 1 day.

void RainCalc()
{
  static float totalRainAmount;
  
  // Reset within 10s after boot or at around beginning of every day (12AM), have 60 s to do
  if ( !dayStart && ( (millis() < 10000 ) || ( (hour() == 0) && (minute() == 0) ) ) )
  {
    dayStart      = true;

    noInterrupts();
    totalAmount   = 0;   
    interrupts();
  }

  // Prepare for next day at 1AM
  if ( dayStart && (hour() == 1) )
  {
     dayStart = false; 
  }

  noInterrupts();
  totalRainAmount = totalAmount;
  interrupts();
  
  Blynk.virtualWrite(BLYNK_VPIN_RAIN_AMOUNT, totalRainAmount); // Rain amount
}

Good luck,