#include <FastLED.h>
#define NUM_LEDS 16
#define DATA_PIN 9
CRGB leds[NUM_LEDS];
#define PIN 9
#include <dht.h>
dht DHT;
#define DHT22_PIN 5 // Set the DHT type.
struct
{
uint32_t total;
uint32_t ok;
uint32_t crc_error;
uint32_t time_out;
uint32_t connect;
uint32_t ack_l;
uint32_t ack_h;
uint32_t unknown;
} stat = { 0,0,0,0,0,0,0,0};
int H;
int T;
int LNT;
int LNH;
void setup() {
Serial.begin(9600);
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}
void loop() {
leds[0] = CRGB(255, 255, 255);
leds[8] = CRGB(255, 255, 255);
if (T < 0){
LNT = DHT.temperature/-5.71428571429;
leds[LNT] = CRGB(0, 0, T*-1*6.375);
LNT=min(LNT, 7);
LNT=max(LNT, 1);
}
if (T > 0){
LNT = DHT.temperature/11.4285714286 +1;
LNT=min(LNT, 7);
leds[LNT] = CRGB(T*3.1875, 0,0);
}
if (H>=70){
LNH = DHT.humidity/6.6;
LNH=min(LNH, 15);
LNH=max(LNH, 12);
leds[LNH] = CRGB(0, 179, 255);
}
if (H<=69.5){
LNH = DHT.humidity/5.83333333333;
LNH=min(LNH, 12);
LNH=max(LNH, 9);
leds[LNH] = CRGB(0, 179, 255);
}
leds[0] = CRGB(255, 255, 255);
H = DHT.humidity;
T = DHT.temperature;
FastLED.show();
FastLED.clear();
uint32_t start = micros();
int chk = DHT.read22(DHT22_PIN);
uint32_t stop = micros();
}