#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()
{
Serial.begin(9600);
Serial.println(" Humidity and Temperature Test!");
dht.begin();
strip.begin();
}
void loop() {
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
if (humidity<45 && temperature<45)
{
Set_colour(strip.Color(0,255,0));
delay(500);
}
else
{
Set_colour(strip.Color(255,0,0));
delay(500);
}
Serial.print(" Humidity: ");
Serial.print(humidity);
Serial.print("% Temperature in C:");
Serial.println(temperature);
}
int Set_colour(uint32_t col)
{
for(int i=0; i<no_of_leds; i++)
{
strip.setPixelColor(i , col);
strip.show();
delay(500);
}
}