#include "DHT.h"
#define DHTPIN 8
#define DHTTYPE DHT22
#define RED_PIN 11
#define GREEN_PIN 10
#define BLUE_PIN 9
DHT dht(DHTPIN, DHTTYPE);
void setup() {
pinMode(RED_PIN, OUTPUT);
pinMode(GREEN_PIN, OUTPUT);
pinMode(BLUE_PIN, OUTPUT);
dht.begin();
}
void setColor(int r, int g, int b) {
analogWrite(RED_PIN, r);
analogWrite(GREEN_PIN, g);
analogWrite(BLUE_PIN, b);
}
void loop() {
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
bool comfortable_temp = temperature >= 20 && temperature < 22;
bool comfortable_hum = humidity >= 40 && humidity < 60;
if (comfortable_temp && comfortable_hum) {
setColor(255, 255, 255); // включаем белый 100%
}
else {
setColor(127, 82, 0); // включаем оранжевый 50%
delay(1500);
setColor(0, 0, 0); // выключаем оранжевый 50%
delay(1500);
}
}