- Posts: 6
- Thank you received: 0
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
void loop() {
delay(dht.getMinimumSamplingPeriod());
float r_hum = dht.getHumidity();
float r_temp = dht.getTemperature();
if (dht.getStatusString() == "OK") {
if (r_hum != 1.0 && r_temp != 0.0) {
m_hum = r_hum;
m_temp = r_temp;
dataOk = true;
}
else {
Serial.print("\t\t");
Serial.print("Bad Read!");
}
}
if (dataOk) {
float delta = m_temp - oldTemp;
if (abs(delta) > 0.01 || (millis() - startTempMillis) > MAX_REPORT_DELAY)
{
sendTeperature(sensorID, m_temp);
startTempMillis = millis();
oldTemp = m_temp;
}
delta = m_hum - oldHum;
if (abs(delta) > 0.01 || (millis() - startHumMillis) > MAX_REPORT_DELAY)
{
sendHumidity(sensorID, m_hum);
startHumMillis = millis();
oldHum = m_hum;
}
int cnt = REPORT_INTERVAL;
while (cnt--)
delay(1000);
}
else {
delay(5000);
}
}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.