//All the variables int ThermistorPin = 35; int Vo; float R1 = 10000; float logR2, R2, T, Tc, Tf; float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07; unsigned long shortTime; unsigned long longTime; float overalltemp = 0; float high = 50; float low = 80; int a; float tenave; int b = 0; float array[150]; int length; void setup() { Serial.begin(115200); } void loop() {1 float tempaveten = 0; //Reads the temperature 600 times and then takes the average of that for the ten minute average for(int i = 0;i<600;i++){ //This converts the thermistor values into fahrenheit Vo = analogRead(ThermistorPin); R2 = R1 * (4096.0 / (float)Vo - 1.0); logR2 = log(R2); T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2)); Tc = T - 273.15; Tf = (Tc * 9.0)/ 5.0 + 32.0; Serial.print(Tf); Serial.println(" F"); delay(990); //Records the length the arduino has been running for length = millis()/60; //This is for taking the input to the serial monitor and giving out the averages if (Serial.available() > 0){ char message = Serial.read(); //When 1 is entered, It returns all the 10 minute averages in the last 24 hours, as well as the maximum and minimum values if (message == '1'){ for (int b = 0; b < 145; b++){ Serial.print("Average "); Serial.print(b); Serial.print(": "); Serial.print(array[b]); Serial.println(" F"); } Serial.print("Minimum Temperature: "); Serial.println(low); Serial.print("Maximum Temperature: "); Serial.println(high); } //When 2 is entered, the total time since the program started is returned else if (message == '2'){ Serial.print("Time since start: "); Serial.print(length); Serial.println(" Seconds"); } } //This is the part recording the 10 minute average, max, and min tempaveten = tempaveten + Tf; overalltemp = overalltemp + Tf; a++; if(Tf < low){ low = Tf; } if(Tf > high){ high = Tf; } } tenave = tempaveten/600; //This prints out the 10 minute average Serial.print("10 Minute average: "); Serial.print(tenave); Serial.println(" F"); //This adds the value to the array array[b] = tenave; b++; //This is the 24 hour average if(a == 86400){ float totalave = overalltemp/a; } }