From 0f0ce916afcdd63b2fc33b3e811debd2ccb97bc8 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Mon, 22 Jul 2019 21:36:50 +0200 Subject: [PATCH] display bme280 values --- src/main.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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()) {