Reputation: 21
I bought the MakerHawk (Heltec) ESP32 with build-in OLED Display. But I was not able to run the OLED example in Arduino IDE.
OLED example SSD1306SimpleDemo from https://github.com/HelTecAutomation/Heltec_ESP32
For testing I just wanted to display something but it was difficult. However I mangaged to solve the Issues and now I want to share it.
First, many compiler errors like:
SSD1306SimpleDemo:35:10: error: 'class Heltec_ESP32' has no member named 'display'
--> Fixed by adding "#define WIFI_LoRa_32" before "#include "heltec.h", without this, the heltec.h will not declare display...
Next compiler errors:
heltec.cpp:104:10: error: 'LED' was not declared in this scope
and
heltec.cpp:109:10: error: 'Vext' was not declared in this scope
--> Fixed by deleting/commenting all lines with "LED" and "Vext" in the heltec.cpp. I think this should be analyzed but for now we leave it here
After this, the code can be compiled succesfully but the display was still black. --> Fixed by setting the "Board:" in Tool section to "Heltec Wifi Lora 32(V2). After Uploading the code the Display shows the sample output.
I dont think this is the final solution but it helped me to continue. Maybe here are some people to figure out why the sample program cannot be compiled and run from sketch...
Upvotes: 2
Views: 2652
Reputation: 21
I solved the problem by only selecting the "Heltec WiFi Lora 32" in Arduino; Tools -> Board -> ESP32 Arduino ->Heltec WiFi Lora 32
Upvotes: 2
Reputation: 88
I don´t know if this help, but I managed to use the display on this board without the buggy Heltec library. You need to install the SSD1306 library, and redefine the SCL and SDA pins, and set the GPIO 16 high. Then the OLED display works (at least in my case..)
#include <Wire.h>
#include "SSD1306Wire.h"
...
#define SDA 4
#define SCL 15
#define OLED_RST 16
...
SSD1306Wire display(0x3c, SDA, SCL);
...
void setup() {
pinMode(OLED_RST, OUTPUT);
digitalWrite(OLED_RST, HIGH);
display.clear();
display.setFont(ArialMT_Plain_16);
display.drawString(0, 0, "IT WORKS");
display.display();
}
Upvotes: 1