Hey guys!
I am using the Heltec ESP32 Wifi kit v3. I want to display temperature values from a sensor on the internal oled as well as on a site.
The sensor part is working well, but the problem is that the onboard display won’t show anything. I tried the display in another project and there it works:
"
#include “heltec.h”
void setup() {
Heltec.begin(true /DisplayEnable Enable/, false /LoRa Disable/, true /Serial Enable/);
Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
Heltec.display->setFont(ArialMT_Plain_10);
Heltec.display->setColor(WHITE);
}
void loop() {
Heltec.display->clear();
Heltec.display->drawString(10, 10,“Hello World”);
Heltec.display->display();
delay(1000);
}
"
But when i try this in my other project with the wifi functions, the display doesn’t work…
"
#ifdef ESP8266
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#elif defined(ESP32)
#include <WiFi.h>
#include <ESPmDNS.h>
#include <hte501I2c.h>
#include “heltec.h”
hte501I2c hte(0x40);
#endif
#include <ESPAsyncWebSrv.h>
#define SDA 19
#define SCL 20
//#define SDA_OLED 17
//#define SCL_OLED 18
float temperature, humidity;
AsyncWebServer server(80); // server port 80
void notFound(AsyncWebServerRequest *request)
{
request->send(404, “text/plain”, “Page Not found”);
}
void setup(void)
{
Serial.begin(115200);
Wire.begin(SDA, SCL); //initialize I2C peripheral (SDA…A4, SCL…A5)
Heltec.begin(true /DisplayEnable Enable/, false /LoRa Disable/, true /Serial Enable/);
Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
Heltec.display->setFont(ArialMT_Plain_10);
Heltec.display->setColor(WHITE);
WiFi.softAP(“ESP32”, “”);
Serial.println(“softap”);
Serial.println("");
Serial.println(WiFi.softAPIP());
if (MDNS.begin(“ESP”)) { //esp.local/
Serial.println(“MDNS responder started”);
}
server.on("/", [](AsyncWebServerRequest * request)
{
hte.startPeriodicMeasurement();
hte.getPeriodicMeasurementTempHum(temperature, humidity);
Serial.println(temperature);
String message = "Temperatur: " + String(temperature);
request->send(200, "text/plain", message);
});
server.onNotFound(notFound);
server.begin(); // it will start webserver
}
void loop(void)
{
Serial.println(“Loop Working”);
Heltec.display->drawString(10, 10,“Hello World”);
Heltec.display->display();
delay(1000);
}
"
Maybe a library is incompatible with the heltec.h lib. Can somebody help me ?