You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

70 lines
1008 B

void htu21()
{
float temphtu = htu.readTemperature()*10;
float rel_hum = htu.readHumidity()*10;
if( temphtu>=0)
{zntemp=1;
}
else
{zntemp=0;
}
temp=abs(temphtu);
if(zntemp==1)//+
{
if(znmax == 1)//+
{if(temp>tempmax)
{tempmax=temp;
znmax=zntemp;
tax =tHour*1000+tMin;}
}
else//-
{tempmax=temp;
znmax=zntemp;
tax =tHour*1000+tMin;
}
if(znmin == 1)//+
{if(temp<tempmin){
tempmin=temp;
znmin=zntemp;
tin =tHour*1000+tMin;}
}
else//-
{tempmin=tempmin;
}
}
if(zntemp==0)//-
{
if(znmax == 1)//+
{tempmax=tempmax;
}
else//-
{if(temp<tempmax){tempmax=temp;
znmax=zntemp;
tax =tHour*1000+tMin;}
}
if(znmin == 1)//+
{tempmin=temp;
znmin=zntemp;
tin =tHour*1000+tMin;
}
else//-
{
if(temp>tempmin){tempmin=temp;
znmin=zntemp;
tin =tHour*1000+tMin;}
}
}
hum=rel_hum;
}