Arduino OLED Ansteuern u8g Display bleibt schwarz.

Hallo ihr Lieben,
ich mochte mit ein Arduino Uno ein OLED Display ansteuern. Der Display ist dieser hier:

https://www.amazon.de/Display-Arduino-SSD1309-Parallel-Interface/dp/B0749DYGSW/ref=sr_1_3?__mk_de_DE=ÅMÅŽÕÑ&dchild=1&keywords=oled+arduino+2%2C42+Zoll&qid=1598524257&sr=8-3

Ich habe wenig Erfahrung damit Display mit ein Arduino anzusteuern und keine Erfahrung mit OLED Displays.

Meine Vorgehensweise war, den Chipnamen des Displays: 'SSD1309' in den Arduino libiry Bibliotheken zu suchen und in der Passenden Bibliothek das 'Hello Word' oder ein 'test01' Programm zu starten und zum laufen zu bringen. Der Display ist von Werk auf das SPI Protikoll eingestellt und dies will ich auch verwenden.

Ich benutze die U8g2 Bibliothek und habe aus der Beispielsammlung das Programm: "HelloWorld.ino" gestartet. In dem Programm habe ich den Kommentar in Zeile 106 Entfernt, sodass ich mein Grafikchip einbinden kann: "U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);"

Meine Pinbelegung ist wie folgt:

Display zu Arduino Uno
CS --> Pin 10
DC --> Pin 9
RES --> Pin 8
SDA --> Pin 11
SCL --> Pin 13
VCC --> 5V
GND --> GND

Trotzdem bleibt der Display schwarz. Ist das Normal das ein OLED schwarz bleibt, auch wenn man ihn mit Spannung versorgt?

Ich habe die Verbindungskabel und die Steckverbindung überprüft, die Leiten alle.

Ich habe den Arduino ausgewechselt und es kommt zum selben Ergebnis.

Die U8g-Lib wird nicht mehr unterstützt.
Warum verwendest du nicht die aktuelle U8g2-Library ?

Hier ist deine Beschreibung fehlerhaft.

Und du musst auch dein Display richtig definieren, ob du I2C oder SPI verwendest.

Bei weiteren Problemen zeigen den kompletten Sketch in Code-Tags.

Und ja, das Display bleibt schwarz, wenn du nichts darauf anzeigst.

/*

  HelloWorld.pde
  
  "Hello World!" example code.
  
  >>> Before compiling: Please remove comment from the constructor of the 
  >>> connected graphics display (see below).
  
  Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
  
  Copyright (c) 2012, olikraus@gmail.com
  All rights reserved.

  Redistribution and use in source and binary forms, with or without modification, 
  are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this list 
    of conditions and the following disclaimer.
    
  * Redistributions in binary form must reproduce the above copyright notice, this 
    list of conditions and the following disclaimer in the documentation and/or other 
    materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
  
*/


#include "U8glib.h"

// setup u8g object, please remove comment from one of the following constructor calls
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device

U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9);	// SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9



void draw(void) {
  // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 0, 22, "Hello World!");
}

void setup(void) {
  // flip screen, if required
  // u8g.setRot180();
  
  // set SPI backup if required
  //u8g.setHardwareBackup(u8g_backup_avr_spi);

  // assign default color value
  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
  
  pinMode(8, OUTPUT);
}

void loop(void) {
  // picture loop
  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );
  
  // rebuild the picture after some delay
  //delay(50);
}

Bitte etschuldigt mein unsauberes ausdrücken. Ich nutze SPI weil ich dafür den Monitor nicht Modifizieren muss und weil mich das eine Kabel mehr nicht stört.
ich kenne mich mit den Bibliotheken nicht aus und weiß nicht, welche gerade unterstützt wird und welche nicht.

/*

  HelloWorld.ino

  Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)

  Copyright (c) 2016, olikraus@gmail.com
  All rights reserved.

  Redistribution and use in source and binary forms, with or without modification, 
  are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this list 
    of conditions and the following disclaimer.
    
  * Redistributions in binary form must reproduce the above copyright notice, this 
    list of conditions and the following disclaimer in the documentation and/or other 
    materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  

*/

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

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

/*
  U8g2lib Example Overview:
    Frame Buffer Examples: clearBuffer/sendBuffer. Fast, but may not work with all Arduino boards because of RAM consumption
    Page Buffer Examples: firstPage/nextPage. Less RAM usage, should work with all Arduino boards.
    U8x8 Text Only Example: No RAM usage, direct communication with display controller. No graphics, 8x8 Text only.
    
*/

// Please UNCOMMENT one of the contructor lines below
// U8g2 Contructor List (Frame Buffer)
// The complete list is available here: https://github.com/olikraus/u8g2/wiki/u8g2setupcpp
// Please update the pin numbers according to your setup. Use U8X8_PIN_NONE if the reset pin is not connected


U8G2_SSD1309_128X64_NONAME0_F_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);  


// End of constructor list


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,20,"Hello World!");	// write something to the internal memory
  u8g2.sendBuffer();					// transfer internal memory to the display
  delay(1000);  
}

ich habe die Bibliothek nun geändert. Danke für den Hinweis. Jetzt geht es.
Wie und Wo kann ich einsehen, ob die Bibliothek die ich gerade verwenden will noch aktuell ist?

Welches ist denn jetzt der aktuelle und richtige Sketch ?

Im ersten verwendest du die alte "U8g-Lib", siehe include.
Im zweiten ist es die "U8g2-Lib"

" Im ersten verwendest du die alte "U8g-Lib", siehe include.
Im zweiten ist es die "U8g2-Lib" "

ja das stimmt. im ersten geht es nicht um im zweiten leuchtet auf dem Display ein "Hello World!"

Verrätst du mir bitte noch, wie ich beim nächsten mal erkenne, ob eine Bibliothek veraltet ist, oder nicht?

rob1991:
Verrätst du mir bitte noch, wie ich beim nächsten mal erkenne, ob eine Bibliothek veraltet ist, oder nicht?

Naja, im speziellen Fall von U8g-Lib steht auf der GitHub-Seite der Library (GitHub - olikraus/u8glib: Arduino Monochrom Graphics Library for LCDs and OLEDs) folgendes:

Note: There will be no more development for U8glib. Please use u8g2.

Uxomm hat es dir ja geschrieben. Aber du musst natürlich für jede eingesetzte Library gesondert drauf achten.

rob1991:
Verrätst du mir bitte noch, wie ich beim nächsten mal erkenne, ob eine Bibliothek veraltet ist, oder nicht?

Etwas größer im Wiki: Home · olikraus/u8glib Wiki · GitHub