Hallo,
Ich bin gerade dabei, das auf dem verlinkten Tutorial gezeigte Display (TTGO ESP32 OLED) mit Adafruit library zum laufen zu bekommen.
Ich habe die Anleitung soweit umgesetzt, nur bekomme ich den folgenden Teil des Tutorials nicht ganz umgesetzt:
"But that’s not going to give us any chance to change the pins. So, instead of passing &Wire as a parameter, let’s create our own I2C object and pass that instead."
"TwoWire twi = TwoWire(1); // our own TwoWire instance on bus 1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &twi, OLED_RESET);"
Ich bin mir ziemlich sicher, dass in meinem Code etwas ergänzt werden muss, nur weiss ich nicht so recht was genau.
Ich wäre für eure Unterstützung sehr dankbar!
Tutorial: TTGO ESP32 board with OLED display and Adafruit library - Machina Speculatrix
Folgender Fehler wird mir als erstes ausgegeben:
"error: 'adafruit_SSD1306' does not name a type
adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &twi, OLED_RESET);
^"
LG
P.s. Mein Code:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 16
Adafruit_SSD1306 display(OLED_RESET);
TwoWire twi = TwoWire(1); // our own TwoWire instance on bus 1
adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &twi, OLED_RESET);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
static const unsigned char PROGMEM logo16_glcd_bmp[] =
{ B00000000, B11000000,
B00000001, B11000000,
B00000001, B11000000,
B00000011, B11100000,
B11110011, B11100000,
B11111110, B11111000,
B01111110, B11111111,
B00110011, B10011111,
B00011111, B11111100,
B00001101, B01110000,
B00011011, B10100000,
B00111111, B11100000,
B00111111, B11110000,
B01111100, B11110000,
B01110000, B01110000,
B00000000, B00110000 };
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
Serial.begin(9600);
twi.begin(4,15); // Needs to come before display.begin is used
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64)
// init done
...