U8glib.h auf dem Node MCU

Hallo, guten Abend!

Ich habe mir ein OLED Display gekauft und schon mehreres ausprobiert.

Einerseits mithilfe der Adafruit Bibliothek und auch mit der "U8glib.h". Ich habe bereits aufwendig frames erstellt und einen genauen Plan was darauf zu sehen sein soll.

Testweise habe ich dann mit unterstützung zahlreicher vergleichbarer YT-Videos ein Programm bei Wokwi für den Arduino UNO geschrieben
Programm bei Wokwi

Das Programm funktioniert in meinen Augen perfekt. Doch leider habe ich von der Hardware her, nur den Node MCU ( Esp 8266 12-F). Wie kann ich das Programm nun verändern, damit es für den Node Mcu passt?

Die passende Bibliothek habe ich natürlich bereits installiert. Es wäre super, wenn mir einer von euch weiterhelfen könnte, da ich mich garnicht mit dieser oder der Adafruit Bibliothek auskenne :melting_face:
Bei weiteren nachfragen stehe ich gerne bereit!
Vielen Dank im Voraus :grinning:

Beste Grüße von funnyfritz

Hier noch einmal der Code:

#include "U8glib.h"

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_NO_ACK | U8G_I2C_OPT_FAST);


const unsigned char epd_bitmap_OhneMotor [] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x84, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x04, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x04, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x04, 0x07, 0xff, 0x84, 
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xe1, 0xfc, 0x78, 0x60, 0x00, 0xf8, 0x04, 0x08, 0x20, 0x78, 
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xf1, 0xfc, 0x78, 0x63, 0xc0, 0xf8, 0x08, 0x10, 0x10, 0x20, 
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xf1, 0xfc, 0x7c, 0x63, 0xc0, 0xf8, 0x08, 0x20, 0x08, 0x20, 
  0x30, 0x1d, 0x83, 0x01, 0xc0, 0x00, 0x1d, 0x83, 0x87, 0x63, 0xe3, 0x06, 0x08, 0x20, 0x08, 0x20, 
  0x33, 0x9d, 0x83, 0x01, 0xc0, 0x03, 0xfd, 0x83, 0x87, 0x7c, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20, 
  0x33, 0x9d, 0x83, 0x01, 0xc0, 0x03, 0xfd, 0x83, 0x87, 0x7c, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20, 
  0x3c, 0xfd, 0x83, 0x01, 0xc0, 0x18, 0x1d, 0x83, 0x87, 0x60, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20, 
  0x3c, 0x7d, 0x83, 0x01, 0xc0, 0x1c, 0x1d, 0x83, 0x87, 0x60, 0x3b, 0x06, 0x08, 0x10, 0x10, 0x20, 
  0x3c, 0x7d, 0x83, 0x01, 0xc0, 0x1c, 0x1d, 0x83, 0x87, 0x70, 0x3b, 0x86, 0x04, 0x08, 0x20, 0x40, 
  0x30, 0x1c, 0x7c, 0x01, 0xff, 0xc3, 0xfd, 0x83, 0x87, 0x7f, 0xc0, 0xf8, 0x04, 0x07, 0xc0, 0x40, 
  0x30, 0x1c, 0x7c, 0x01, 0xff, 0xc3, 0xfd, 0x83, 0x87, 0x7f, 0xc0, 0xf8, 0x02, 0x00, 0x00, 0x80, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x80, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x06, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

// '1drehung', 16x9px
const unsigned char epd_bitmap_1drehung [] PROGMEM = {
  0x00, 0x80, 0x04, 0x90, 0x02, 0xa0, 0x01, 0xc0, 0x0f, 0xf8, 0x01, 0xc0, 0x02, 0xa0, 0x04, 0x90, 
  0x00, 0x80
};
// '2drehung', 16x9px
const unsigned char epd_bitmap_2drehung [] PROGMEM = {
  0x00, 0x40, 0x02, 0x40, 0x01, 0x50, 0x0f, 0xe0, 0x03, 0xe0, 0x03, 0xf8, 0x05, 0xc0, 0x01, 0x20, 
  0x01, 0x00
};
// '3drehung', 16x9px
const unsigned char epd_bitmap_3drehung [] PROGMEM = {
  0x01, 0x00, 0x01, 0x20, 0x05, 0xc0, 0x03, 0xf8, 0x01, 0xe0, 0x0f, 0xe0, 0x01, 0xd0, 0x02, 0x40, 
  0x00, 0x40
};

const int epd_bitmap_allArray_LEN = 3;
const unsigned char* epd_bitmap_allArray[3] = {
  epd_bitmap_1drehung,
  epd_bitmap_2drehung,
  epd_bitmap_3drehung
};

int progress = 0;
int frame = 0;

void setup() {
  u8g.setFont(u8g_font_tpssb);
  u8g.setColorIndex(1);
}

void loop() {
  u8g.firstPage();
  do {
    
  
    u8g.drawBitmapP(0,0,128/8,32,epd_bitmap_OhneMotor);

   u8g.drawBitmapP(103,11,16/8,9,epd_bitmap_allArray[frame]);

  } while ( u8g.nextPage() );

  frame=frame+1;
  if (frame > 2) {frame=0;}
}

Quelle oder Typ?
I2C oder SPI ?
Pins anpassen, Code drauf laufen lassen :wink:
Die U8g funktioniert auch mit ESP.

Ich verstehe dein Problem nicht.
Funktioniert dein Oled mit dem NodeMCU, oder funktionirt es nicht ?
Wenn nicht, was genau ist der Fehler ?
Und wie hast du das Oled am NodeMCU angeschlossen ?
Und du solltest besser die U8g2lib.h verwenden, die ist aktueller.

Oli schreibt: "There will be no more development for U8glib. Please use u8g2."

Einen ESP8266 habe ich nicht, daher mit einem ESP32 getestet:

#include <U8g2lib.h>

U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

const unsigned char epd_bitmap_OhneMotor [] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x84,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x04,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x04,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04,
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04,
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04,
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x04, 0x07, 0xff, 0x84,
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xe1, 0xfc, 0x78, 0x60, 0x00, 0xf8, 0x04, 0x08, 0x20, 0x78,
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xf1, 0xfc, 0x78, 0x63, 0xc0, 0xf8, 0x08, 0x10, 0x10, 0x20,
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xf1, 0xfc, 0x7c, 0x63, 0xc0, 0xf8, 0x08, 0x20, 0x08, 0x20,
  0x30, 0x1d, 0x83, 0x01, 0xc0, 0x00, 0x1d, 0x83, 0x87, 0x63, 0xe3, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x33, 0x9d, 0x83, 0x01, 0xc0, 0x03, 0xfd, 0x83, 0x87, 0x7c, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x33, 0x9d, 0x83, 0x01, 0xc0, 0x03, 0xfd, 0x83, 0x87, 0x7c, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x3c, 0xfd, 0x83, 0x01, 0xc0, 0x18, 0x1d, 0x83, 0x87, 0x60, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x3c, 0x7d, 0x83, 0x01, 0xc0, 0x1c, 0x1d, 0x83, 0x87, 0x60, 0x3b, 0x06, 0x08, 0x10, 0x10, 0x20,
  0x3c, 0x7d, 0x83, 0x01, 0xc0, 0x1c, 0x1d, 0x83, 0x87, 0x70, 0x3b, 0x86, 0x04, 0x08, 0x20, 0x40,
  0x30, 0x1c, 0x7c, 0x01, 0xff, 0xc3, 0xfd, 0x83, 0x87, 0x7f, 0xc0, 0xf8, 0x04, 0x07, 0xc0, 0x40,
  0x30, 0x1c, 0x7c, 0x01, 0xff, 0xc3, 0xfd, 0x83, 0x87, 0x7f, 0xc0, 0xf8, 0x02, 0x00, 0x00, 0x80,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x80,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x06, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

// '1drehung', 16x9px
const unsigned char epd_bitmap_1drehung [] PROGMEM = {
  0x00, 0x80, 0x04, 0x90, 0x02, 0xa0, 0x01, 0xc0, 0x0f, 0xf8, 0x01, 0xc0, 0x02, 0xa0, 0x04, 0x90,
  0x00, 0x80
};
// '2drehung', 16x9px
const unsigned char epd_bitmap_2drehung [] PROGMEM = {
  0x00, 0x40, 0x02, 0x40, 0x01, 0x50, 0x0f, 0xe0, 0x03, 0xe0, 0x03, 0xf8, 0x05, 0xc0, 0x01, 0x20,
  0x01, 0x00
};
// '3drehung', 16x9px
const unsigned char epd_bitmap_3drehung [] PROGMEM = {
  0x01, 0x00, 0x01, 0x20, 0x05, 0xc0, 0x03, 0xf8, 0x01, 0xe0, 0x0f, 0xe0, 0x01, 0xd0, 0x02, 0x40,
  0x00, 0x40
};

const int epd_bitmap_allArray_LEN = 3;
const unsigned char* epd_bitmap_allArray[3] = {
  epd_bitmap_1drehung,
  epd_bitmap_2drehung,
  epd_bitmap_3drehung
};

int progress = 0;
int frame = 0;

void setup() {
  u8g.begin();
  u8g.setFont(u8g2_font_8x13_tr);
  u8g.setColorIndex(1);
}

void loop() {
  u8g.drawBitmap(0, 0, 128 / 8, 32, epd_bitmap_OhneMotor);
  u8g.drawBitmap(103, 11, 16 / 8, 9, epd_bitmap_allArray[frame]);
  u8g.sendBuffer();

  frame = frame + 1;
  if (frame > 2) {
    frame = 0;
  }
}

EDIT 20220831: Foto ergänzt

Vielen Dank für eure Rückmeldungen!

Ich habe hier ein 128*32Pixel I2C Display vor mir. Angeschlossen wie folgt:

GND-GND | VCC-3v3 | SCK-D1 | SDA-D2

Mithilfe der neuren Bibliothek konnte ich das Programm endlich hochladen.

Zuvor konnte ich das Programm garnicht auf meinen ESP 8266 hochladen. Ich war mir daher unsicher, ob die Bibliothek auch für diesen ESP geeignet ist. Jetzt geht es, jedoch sehe ich nichts :joy:

Das Display bleibt also trotzdem weiterhin dunkel, als wäre es aus.
Habe im Internet bisher nichts näheres gefunden - passen die Pins?
SCK-D1 | SDA-D2

Beste Grüße

Falsch gesucht :wink:
bei allen ESP benutzt man GPIO Nr nicht D
Für ESP8266 gilt
SDA GPIO4 (Man schreibt nur 4 ohne D)
SCL GPIO5
Wurde versucht das Beispiel vom @agmue hochladen?
Wurde als erstes versuchen
Wie ist das Display angeschlossen? Foto einstellen

:melting_face: Laut dem Internet passt das "GPIO4" sei "D2" usw... etwas verwirrend :sweat_smile:

Genau, ich arbeite gerade nur mit dem Beispiel von @agmue - Danke dafür :grin:

Je nach ESP Modul ist dort wo RSV (gegenüber D2,D1)ist GND und +5V, wen ja dort den anklemmen wen das Display 5V kompatibel ist, oder auf VIN gehen sollte da drauf um die 4,5V sein

Danke für den Tipp. Daran hat es aber leider auch nicht gelegen.

Bspw. mit der Adafruit Demo-Software hat es ja auch geklappt. An der Stromzufuhr liegt es nicht :melting_face:
Wenn alles richtig angeschlossen ist und es dennoch nicht klappt: Gibt es auch eine Möglichkeit das ganze mithilfe Adafruit zu machen? Ziel ist es, dass das ganze so aussieht wie in meinem Programm bei Wokwi

Dan bin ich raus habe nicht dein Display Model.

In #4 habe ich ein Foto meines Aufbaus ergänzt. Das Lüfterrad in der Mitte dreht sich.

Hast Du schon mal \U8g2\examples\full_buffer\HelloWorld\HelloWorld.ino probiert?


#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>

U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

void setup(void) {
  u8g2.begin();
}

void loop(void) {
  u8g2.clearBuffer();         // clear the internal memory
  u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
  u8g2.drawStr(0, 10, "Hello World!"); // write something to the internal memory
  u8g2.sendBuffer();          // transfer internal memory to the display
  delay(1000);
}

Damit habe auch ich gestern angefangen, um die Verkabelung zu überprüfen.

Ist Dein Display tauglich für 3,3 V? Dann hast Du es m. E. richtig angeschlossen.

Hey, super ja das habe ich jetzt gerade!

Da ich ja leider ein kleineres Display habe, hab ich diese Zeile Code durch:

U8G2_SH1106_128X32_VISIONOX_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

ersetzt. Jetzt ist das Hello World auch wunderbar erkenntlich und passend oben links in der Ecke.

Wenn ich diese Zeile, mit der Zeile

austausche, kommt leider auch ein Error heraus.

PS: Wow super Foto :star_struck: Hätte nicht gedacht, dass ihr hier so einen Aufwand betreibt! Danke vielmals

Im Konstruktor gibst Du dem Display einen Namen, der sich dann bei den Methoden der Bibliothek wiederholt. Beispiel für "oled" als Namen:

U8G2_SH1106_128X32_VISIONOX_F_HW_I2C oled(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
...
  oled.clearBuffer();

Wie bei Variablen muß der Name überall stimmen.

Bei meinem ESP32 mit SH1106 funktioniert Dein Programm so:

//#include <Arduino.h>  // beim ESP32 wird diese Zeile nicht benötigt
#include <U8g2lib.h>
//#include <Wire.h>     // beim ESP32 wird diese Zeile nicht benötigt

//U8G2_SH1106_128X32_VISIONOX_F_HW_I2C oled(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
U8G2_SH1106_128X64_NONAME_F_HW_I2C oled(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

const unsigned char epd_bitmap_OhneMotor [] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x84,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x04,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x04,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04,
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04,
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04,
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x04, 0x07, 0xff, 0x84,
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xe1, 0xfc, 0x78, 0x60, 0x00, 0xf8, 0x04, 0x08, 0x20, 0x78,
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xf1, 0xfc, 0x78, 0x63, 0xc0, 0xf8, 0x08, 0x10, 0x10, 0x20,
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xf1, 0xfc, 0x7c, 0x63, 0xc0, 0xf8, 0x08, 0x20, 0x08, 0x20,
  0x30, 0x1d, 0x83, 0x01, 0xc0, 0x00, 0x1d, 0x83, 0x87, 0x63, 0xe3, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x33, 0x9d, 0x83, 0x01, 0xc0, 0x03, 0xfd, 0x83, 0x87, 0x7c, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x33, 0x9d, 0x83, 0x01, 0xc0, 0x03, 0xfd, 0x83, 0x87, 0x7c, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x3c, 0xfd, 0x83, 0x01, 0xc0, 0x18, 0x1d, 0x83, 0x87, 0x60, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x3c, 0x7d, 0x83, 0x01, 0xc0, 0x1c, 0x1d, 0x83, 0x87, 0x60, 0x3b, 0x06, 0x08, 0x10, 0x10, 0x20,
  0x3c, 0x7d, 0x83, 0x01, 0xc0, 0x1c, 0x1d, 0x83, 0x87, 0x70, 0x3b, 0x86, 0x04, 0x08, 0x20, 0x40,
  0x30, 0x1c, 0x7c, 0x01, 0xff, 0xc3, 0xfd, 0x83, 0x87, 0x7f, 0xc0, 0xf8, 0x04, 0x07, 0xc0, 0x40,
  0x30, 0x1c, 0x7c, 0x01, 0xff, 0xc3, 0xfd, 0x83, 0x87, 0x7f, 0xc0, 0xf8, 0x02, 0x00, 0x00, 0x80,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x80,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x06, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

// '1drehung', 16x9px
const unsigned char epd_bitmap_1drehung [] PROGMEM = {
  0x00, 0x80, 0x04, 0x90, 0x02, 0xa0, 0x01, 0xc0, 0x0f, 0xf8, 0x01, 0xc0, 0x02, 0xa0, 0x04, 0x90,
  0x00, 0x80
};
// '2drehung', 16x9px
const unsigned char epd_bitmap_2drehung [] PROGMEM = {
  0x00, 0x40, 0x02, 0x40, 0x01, 0x50, 0x0f, 0xe0, 0x03, 0xe0, 0x03, 0xf8, 0x05, 0xc0, 0x01, 0x20,
  0x01, 0x00
};
// '3drehung', 16x9px
const unsigned char epd_bitmap_3drehung [] PROGMEM = {
  0x01, 0x00, 0x01, 0x20, 0x05, 0xc0, 0x03, 0xf8, 0x01, 0xe0, 0x0f, 0xe0, 0x01, 0xd0, 0x02, 0x40,
  0x00, 0x40
};

const int epd_bitmap_allArray_LEN = 3;
const unsigned char* epd_bitmap_allArray[3] = {
  epd_bitmap_1drehung,
  epd_bitmap_2drehung,
  epd_bitmap_3drehung
};

int progress = 0;
int frame = 0;

void setup() {
  oled.begin();
  oled.setColorIndex(1);
}

void loop() {
  oled.drawBitmap(0, 0, 128 / 8, 32, epd_bitmap_OhneMotor);
  oled.drawBitmap(103, 11, 16 / 8, 9, epd_bitmap_allArray[frame]);
  oled.sendBuffer();

  frame = frame + 1;
  if (frame > 2) {
    frame = 0;
  }
}

Für 128x32 mußt Du den anderen Konstruktor nehmen und ggf. die kommentierten Zeilen für den ESP8266 aktivieren.

Foto mit SH1106:

1 Like

Vielen Dank für den Aufwand, super Erklärung @agmue !
Ich habe soeben nochmal bei dem Händler nachgeschaut. Angegeben steht "SSD1306" - Somit sollte diese Zeile code richtig sein :sweat_smile:

U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ SCL, /* data=*/ SDA);

Im "Hello World" Beispielprogramm funktioniert auch alles wunderbar:

#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>

U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0,  U8X8_PIN_NONE,  SCL, SDA);

void setup(void) {
  u8g2.begin();
}

void loop(void) {
  u8g2.clearBuffer();         
  u8g2.setFont(u8g2_font_ncenB08_tr); 
  u8g2.drawStr(0, 10, "Hello World!"); 
  u8g2.sendBuffer();          
  delay(1000);
}

Doch in meinem Programm, das wie folgt aussieht

#include <Arduino.h>  // beim ESP32 wird diese Zeile nicht benötigt
#include <U8g2lib.h>
#include <Wire.h>     // beim ESP32 wird diese Zeile nicht benötigt

U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE, SCL, SDA); 

const unsigned char epd_bitmap_OhneMotor [] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x84,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x04,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x04,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04,
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04,
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04,
  0x30, 0x1c, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x04, 0x07, 0xff, 0x84,
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xe1, 0xfc, 0x78, 0x60, 0x00, 0xf8, 0x04, 0x08, 0x20, 0x78,
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xf1, 0xfc, 0x78, 0x63, 0xc0, 0xf8, 0x08, 0x10, 0x10, 0x20,
  0x30, 0x1c, 0x7c, 0x01, 0xc0, 0x1f, 0xf1, 0xfc, 0x7c, 0x63, 0xc0, 0xf8, 0x08, 0x20, 0x08, 0x20,
  0x30, 0x1d, 0x83, 0x01, 0xc0, 0x00, 0x1d, 0x83, 0x87, 0x63, 0xe3, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x33, 0x9d, 0x83, 0x01, 0xc0, 0x03, 0xfd, 0x83, 0x87, 0x7c, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x33, 0x9d, 0x83, 0x01, 0xc0, 0x03, 0xfd, 0x83, 0x87, 0x7c, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x3c, 0xfd, 0x83, 0x01, 0xc0, 0x18, 0x1d, 0x83, 0x87, 0x60, 0x3b, 0x06, 0x08, 0x20, 0x08, 0x20,
  0x3c, 0x7d, 0x83, 0x01, 0xc0, 0x1c, 0x1d, 0x83, 0x87, 0x60, 0x3b, 0x06, 0x08, 0x10, 0x10, 0x20,
  0x3c, 0x7d, 0x83, 0x01, 0xc0, 0x1c, 0x1d, 0x83, 0x87, 0x70, 0x3b, 0x86, 0x04, 0x08, 0x20, 0x40,
  0x30, 0x1c, 0x7c, 0x01, 0xff, 0xc3, 0xfd, 0x83, 0x87, 0x7f, 0xc0, 0xf8, 0x04, 0x07, 0xc0, 0x40,
  0x30, 0x1c, 0x7c, 0x01, 0xff, 0xc3, 0xfd, 0x83, 0x87, 0x7f, 0xc0, 0xf8, 0x02, 0x00, 0x00, 0x80,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x80,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x06, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

// '1drehung', 16x9px
const unsigned char epd_bitmap_1drehung [] PROGMEM = {
  0x00, 0x80, 0x04, 0x90, 0x02, 0xa0, 0x01, 0xc0, 0x0f, 0xf8, 0x01, 0xc0, 0x02, 0xa0, 0x04, 0x90,
  0x00, 0x80
};
// '2drehung', 16x9px
const unsigned char epd_bitmap_2drehung [] PROGMEM = {
  0x00, 0x40, 0x02, 0x40, 0x01, 0x50, 0x0f, 0xe0, 0x03, 0xe0, 0x03, 0xf8, 0x05, 0xc0, 0x01, 0x20,
  0x01, 0x00
};
// '3drehung', 16x9px
const unsigned char epd_bitmap_3drehung [] PROGMEM = {
  0x01, 0x00, 0x01, 0x20, 0x05, 0xc0, 0x03, 0xf8, 0x01, 0xe0, 0x0f, 0xe0, 0x01, 0xd0, 0x02, 0x40,
  0x00, 0x40
};

const int epd_bitmap_allArray_LEN = 3;
const unsigned char* epd_bitmap_allArray[3] = {
  epd_bitmap_1drehung,
  epd_bitmap_2drehung,
  epd_bitmap_3drehung
};

int progress = 0;
int frame = 0;

void setup() {
  u8g2.begin();
  u8g2.setColorIndex(1);
}

void loop() {
  u8g2.drawBitmap(0, 0, 128 / 8, 32, epd_bitmap_OhneMotor);
  u8g2.drawBitmap(103, 11, 16 / 8, 9, epd_bitmap_allArray[frame]);
  u8g2.sendBuffer();

  frame = frame + 1;
  if (frame > 2) {
    frame = 0;
  }
}

wird mir leider garnichts auf dem Display angezeigt und es bleibt somit "aus". Ist es möglich, dass die gesamte Animation vielleicht nicht in den Sichtbaren Koordinaten liegt?

Eher nicht, da es bei mir ja funktioniert.

Schade. Habe die letzten Tage das ganze auch mit einem anderen identischen Node MCU probiert, doch leider auch nichts sichtbares....
@agmue Gibt es ansonsten eine Möglichkeit das ganze mit Adafruit oder anderen Bibliotheken leicht nachzubilden?
Wäre sehr froh, wenn mir jemand einen Link zu einem Vergleichbaren Projekt schickt :stuck_out_tongue_winking_eye: Denn ein funktionierendes Programm etwas abzuendern, müsste kein Problem für mich sein.
Vielen Dank auch schon jetzt nochmal
Beste Grüße :grinning:

PS: Wenn jemand auch im Nachhinein noch Anregungen/Lösungsvorschläge zu meinem Problem mit U8glib.h hat, kann er sich sehr gerne jederzeit hier noch dazu äußern!

Bei diesem Thema fühle ich mich etwas unwohl, weil es natürlich Unterschiede zwischen ESP8266 und ESP32 gibt. Daher wäre jemand mit ESP8266, OLED und entsprechender Erfahrung besser geeignet.

Sonst müssen wir uns schrittweise der Lösung nähern :wink:

Welches Programm läßt denn auf dem OLED was anzeigen?

Welcher Konstruktor funktioniert?

U8G2_SH1106_128X32_VISIONOX_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); 
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);  // Adafruit ESP8266/32u4/ARM Boards + FeatherWing OLED
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ SCL, /* data=*/ SDA);   // pin remapping with ESP8266 HW I2C
U8G2_SSD1306_128X32_WINSTAR_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ SCL, /* data=*/ SDA);   // pin remapping with ESP8266 HW I2C

Soweit so gut :+1:
Mit den oberen dreien einzeln im Konstruktor funktioniert das Beispielprogramm "Hello World".
Habe jedes jetzt auch seperat in meinem Programm ausprobiert - jedoch leider kein Bild

Dan zeige Dein Sketsch so wie es wird versuchen.
Du hast vermutlich Fehler bei Kompilieren den drawBitmapP gibt er nicht in u8g2, laut Lib ist der Konstruktor:

void drawBitmap(u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t cnt, u8g2_uint_t h, const uint8_t *bitmap)

Dann fang mal ganz vorne an und ersetze einfach Deinen Loop durch den aus dem "Hello World".

Wenn der geht, dann ein neues loop nur mit clearBuffer(), bpd_bitmap_OhneMotor und sendBuffer().
Wenn Du jetzt die Bitmap siehst, kannst Du den nächsten Schritt machen.

Wo hast Du den her? Der Sketch aus #14 kompiliert Fehlerfrei.