#include <DHT.h>
int dht_pin = 2;
#include <Adafruit_NeoPixel.h>
int neo_pin = 9;
int no_of_leds = 16;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(no_of_leds, neo_pin);
DHT dht(dht_pin, DHT22);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Humidity and Temperature Test!");
dht.begin();
strip.begin();
}
void loop() {
// put your main code here, to run repeatedly:
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
if (humidity < 45 && temperature < 45) {
Set_color(strip.Color(0, 255, 0));
delay(500);
}
else {
Set_color(strip.Color(255, 0, 0));
delay(500);
}
Serial.print(" Humidity: ");
Serial.print(humidity);
Serial.print(" % Temperature in °C: ");
Serial.print(temperature);
}
int Set_color(uint32_t col)
{
for(int i = 0; i < no_of_leds; i++)
{
strip.setPixelColor(i, col);
strip.show();
delay(500);
}
}