File size: 530 Bytes
8e53a3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
  Read humidity sensor value and compare with the input value
  03 MAY 2025 by Blind Author
*/
#include <Arduino.h>
#include "DHT.h"

#define DHTTYPE DHT22

#define DHTPIN 2

DHT dht(DHTPIN, DHTTYPE);

float threshold = 50.0;

void setup() {
  Serial.begin(9600);
  dht.begin();
}

void loop() {
    float humidity = dht.readHumidity();

    if (humidity < threshold) {
        Serial.println("Humidity is below the threshold");
    } else {
        Serial.println("Humidity is above the threshold");
    }

    delay(1000);
}