How to keep a 24 hour maximum and minimum temperature I am keeping a simple weather station to monitor humidity and temperature in my greenhouse. I have a ds18b20 and dht probes.  everything works great and I even used a little trick to hold my maximum and minimum values, but I would like them to reset every 24 hours. Is there anyway i can code the arduino to reset itself. i tried several examples of connecting digital pins to the reset pin and i couldn't get any of those to work.  i tried to reset the values of my max and min to 0 and 99 respectively after my millis() reached the equivalent of a day, but they just stuck at 0 and 999. I understand fully why it does this i just don't know how to fix it. all i want to do is reset my minimum and maximum temperatures after 24 hours.

//       Green HAUS Version 1 by Kent Scipione 9/3/2017
//       Monitors temperature and humidity
long timenow;
long day = 86400000; // 86400000 milliseconds in a day
long hour = 3600000; // 3600000 milliseconds in an hour
long minute = 60000; // 60000 milliseconds in a minute
long second =  1000; // 1000 milliseconds in a second

#include &lt;OneWire.h&gt;
#include &lt;DallasTemperature.h&gt;
#include &lt;SPI.h&gt;
#include &lt;Adafruit_SSD1306.h&gt;
#define OLED_RESET 4
#define ONE_WIRE_BUS 10
double temp;  // sensor is precise to .1 degree. 
//Double gives smoother serial graph, byte doesn't overflow oled screen
Adafruit_SSD1306 display(OLED_RESET);
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&amp;oneWire);

#include &lt;Adafruit_Sensor.h&gt;
#include "DHT.h"
#define DHTPIN 2    
#define DHTTYPE DHT22   
DHT dht(DHTPIN, DHTTYPE);

int maxtemp=0;
int mintemp=999;


void setup() {

  Serial.begin(9600);
  Serial.println("green HAUS Version 1 by Kent Scipione 9/3/2017");
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.display();
  display.setTextColor(WHITE);
  sensors.begin();
  dht.begin();

}

void loop() {
  timenow = millis();
  sensors.requestTemperatures(); 
  temp = sensors.getTempFByIndex(0); 
  int humid = dht.readHumidity();
  float dtemp = dht.readTemperature(true);
  if (temp &gt; maxtemp) {
    maxtemp=temp; }
  if (temp &lt; mintemp) {
    mintemp=temp; }

  if (timenow &gt;= day){
      digitalWrite(4, HIGH);
      pinMode(4, OUTPUT);       //*************************this is the part where I'm trying to reset the mintemp and maxtemp**********


    }


  Serial.print("Probe Temperature: ");
  Serial.println(temp); Serial.println("*F");
  display.setCursor(0,0);  //refreshes display
  display.clearDisplay();
  display.setTextSize(1); display.print("Probe "); display.println(temp);  //line 1 of text
  display.print("DHT  "); display.print(dtemp); display.print("  "); display.print(humid); display.println(" %");  //line 2 of text
  display.print("HIGH "); display.println(maxtemp);           //line 3 of text
  display.print("LOW  "); display.println(mintemp);   //line 4 of text
  display.display();

}


Thank you so much for your help this is driving me mad haha
You should also keep a timestamp of the last time you reset the min and max otherwise the arduino will keep thinking it's a new day:

//add to globals
unsigned long lastDay = 0;


and inside loop()

  if (timenow-lastday &gt;= day){

      maxtemp=0;
      mintemp=999;
      lastDay = timenow;
  }