#include <dht.h>
#include <TM1637Display.h>
#define CLK 2
#define DIO 3
#define DHTPIN 4
dht DHT;
TM1637Display display(CLK, DIO);
uint8_t getTemperature()
{
uint8_t t = (DHT.temperature * 1.8) + 32.0;
t = t > 99 ? 99 : t < 10 ? 10 : t;
return t;
}
void setup()
{
pinMode(DHTPIN, INPUT);
display.setBrightness(7);
}
void loop()
{
DHT.read22(DHTPIN);
uint8_t temperature = getTemperature();
uint8_t humidity = DHT.humidity;
display.showNumberDecEx(temperature, 0x80, 2, 2);
display.showNumberDecEx(humidity, 0x80, true, 2, 2);
delay(1000);
}