//DISPLAY #include #include // Module connection pins (Digital Pins) #define CLK 4 #define DIO 3 TM1637Display display(CLK, DIO); // THERMOMETER #include #include #include #define DHTPIN 6 // Pin which is connected to the DHT sensor. #define DHTTYPE DHT11 // DHT 11 DHT_Unified dht(DHTPIN, DHTTYPE); uint32_t delayMS; const int b1pin = 8; const int b2pin = 9; const int b3pin = 10; int b1state = 0; int b2state = 0; int b3state = 0; bool serial = true; void setup() { int brightness = 15; display.setBrightness(brightness); display.showNumberDec(8888); dht.begin(); //sensor_t sensor; //dht.temperature().getSensor(&sensor); Serial.begin(9600); int count = 0; while (!Serial) { if (count > 8000 * 5000) { serial = false; // wait for serial port to connect. Needed for native USB port only return; } } } void loop() { temp(); delay(200); humidity(); delay(200); } void temp () { sensors_event_t event; dht.temperature().getEvent(&event); int temp = event.temperature; display.showNumberDecEx(temp, 0, false, 2, 0); if (serial) { Serial.print("temp: "); Serial.println(temp, DEC); } } void humidity() { sensors_event_t event; dht.humidity().getEvent(&event); int temp = event.relative_humidity; display.showNumberDecEx(temp, 0, false, 2, 2); if (serial) { Serial.print("humi: "); Serial.println(temp, DEC); } }