I have a little project I'm working on to monitor temperatures on 2 different temp sensors. I have a piece of code that looks like the following to log the highest and lowest temp and humidity so I can graph it later.
if(DHT11.humidity<tHumMin) { tHumMin=DHT11.humidity; }
if(DHT11.humidity>tHumMax) { tHumMax=DHT11.humidity; }
if(DHT11.temperature<tTempMin) { tTempMin=DHT11.temperature; }
if(DHT11.temperature>tTempMax) { tTempMax=DHT11.temperature; }
My question is, is there a way to do something like this:
for(i=1;i<3;i++) {
if(DHT11.humidity<(tHumMin+i)) { (tHumMin+i)=DHT11.humidity; }
if(DHT11.humidity>(tHumMax+i)) { (tHumMax+i)=DHT11.humidity; }
if(DHT11.temperature<(tTempMin+i)) { (tTempMin+i)=DHT11.temperature; }
if(DHT11.temperature>(tTempMax+i)) { (tTempMax+i)=DHT11.temperature; }
};
To avoid confusion, I want to turn tHumMin into tHumMin1 or tHumMin2 based on i from the for loop. I've declared all the variables and tried a few different things but I can't seem to figure out how to do this.