read delay

This commit is contained in:
Siwat Sirichai 2024-06-28 12:17:49 +07:00
parent f71ae18a7b
commit f6a697fb09
2 changed files with 3 additions and 1 deletions

View File

@ -28,6 +28,7 @@ void loop() {
int temperature = readTemperature(); int temperature = readTemperature();
if (temperature == DHT_ERROR_VALUE) { if (temperature == DHT_ERROR_VALUE) {
Serial.println("Error reading temperature"); Serial.println("Error reading temperature");
delay(2000);
return; return;
} }
Serial.print("Temperature: "); Serial.print("Temperature: ");
@ -40,6 +41,7 @@ void loop() {
turnFanOff(); turnFanOff();
turnLedOff(); turnLedOff();
} }
delay(2000);
} }
/** /**

View File

@ -14,7 +14,7 @@
#define BUZZER_PIN 4 #define BUZZER_PIN 4
#define DHT_PIN 2 #define DHT_PIN 2
#define FAN_ON_TEMP 35 #define FAN_ON_TEMP 30
#define FAN_SPEED 120 #define FAN_SPEED 120
#define DHT_ERROR_VALUE -999 #define DHT_ERROR_VALUE -999