so i wired the arduino up with the lm35 temp sensor and the lcd and test a sample code on a tutorial and it works. but it only tells the current temperature in the room on the lcd. so i decided to write some new code but i don't know how. can someone help me?
it need to these things
current temperature Celsius and Farenait
average temperature Celsius and Farenait
min/max temperature Celsius and Farenait
i have a Mega 2560 Rev3
please help
Edit: I included some pictures that burn mark was not me.
Average during what ? during a day ? only for a day (starting at midnight) ? or for the last 24 hours ? or longer ?
min/max for a day, or do you want to reset the values with a button ? or the min/max for each day for many days ?
Create a float for min and max, initialize them to the current temperature and check for higher or lower.
For the average, you could takes samples every minute and add them.
You can use float or long. If you use long, you should use the temperature in centigrade.
float mintemp, maxtemp, addtemp;
int count;
// reset every 24 hours.
mintemp = maxtemp = current_temperature;
count = 0;
addtemp 0.0;
// every minute or faster or free running without timing.
if (current_temperature < mintemp)
mintemp = current_temperature;
if (current_temperature > maxtemp)
maxtemp = current_temperature;
// every minute
// the average temperature will be addtemp / (float) count;
addtemp += current_temperature;
count++;
Thanks I made the code with what you've posted and now it works perfectly displaying every I needed above on the first post that I did
Here is some pictures