diff --git a/src/main.cpp b/src/main.cpp index 71a6c6c..9005c07 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,6 +35,8 @@ SdsDustSensor sds(Serial2); XD0MQTT mqtt; +uint32_t lastDisplayUpdate = 0; + void helloWorld() { @@ -142,6 +144,33 @@ void setup() void loop() { Serial.println("loop"); + + if (millis() - lastDisplayUpdate >= 2*60*1000) { + lastDisplayUpdate = millis(); + display.setFullWindow(); + display.setRotation(0); + display.firstPage(); + do + { + display.fillScreen(GxEPD_WHITE); + display.setTextColor(GxEPD_BLACK); + display.setFont(&FreeMonoBold9pt7b); + display.setCursor(0, 0); + display.println("ESP32-Wetterstation"); + display.println(); + display.print("Temperatur: "); + display.print(bme.readTemperature()); + display.println(" *C"); + display.print("Luftfeuchte: "); + display.print(bme.readHumidity()); + display.println(" %%"); + display.print("Luftdruck:"); + display.print(bme.readPressure() / 100.0F); + display.println(" hPa"); + } + while (display.nextPage()); + + } /* unsigned long endTime = bme.beginReading(); if (! bme.performReading()) {