olikraus / u8g2

U8glib library for monochrome displays, version 2
Other
5.08k stars 1.05k forks source link

OLED SPI SSD1309 128x64 2,4'' #2189

Open fatima00ruma opened 1 year ago

fatima00ruma commented 1 year ago

Hi, I'm ussing an ESP32 wroom 32 from az delivery with OLED 2,4'' SPI SSD1309 128x64. With the library U8g2 I finally see some letters in the screen, but only 8 pixels. Anyone knows the reason? This is the code I made for Visual Studio Code:

include

include

include

U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, / cs=/ 5, / dc=/ 32, / reset=/ 4); void setup() { u8g2.begin(); }

void loop() { u8g2.clearBuffer(); u8g2.setFont(u8g2_font_ncenB14_tr); u8g2.setCursor(0, 14); u8g2.print("Hello World!"); //u8g2.setFont(u8g2_font_ncenB08_tr); //u8g2.drawStr(0,8,"Hello World!"); u8g2.sendBuffer(); delay(1000); }

WhatsApp Image 2023-06-02 at 13 28 31

fatima00ruma commented 1 year ago

the pins I used are: MOSI = IO23 and SCLK= IO18

fatima00ruma commented 1 year ago

who solves the problem I will add him in my end-of-degree project, thanks

fatima00ruma commented 1 year ago

@olikraus help me please!!!

olikraus commented 1 year ago

Use

U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, /* cs=/ 5, / dc=/ 32, / reset=*/ 4);
fatima00ruma commented 1 year ago

It doesnt't work, NONAME with SSD1306 is only for I2C, and I'm ussing SPI. This are the options for SSD1306: //U8G2_SSD1306_128X32_UNIVISION_1_SW_I2C u8g2(U8G2_R0, / clock=/ 21, / data=/ 20, / reset=/ U8X8_PIN_NONE); // Adafruit Feather M0 Basic Proto + FeatherWing OLED //U8G2_SSD1306_128X32_UNIVISION_1_SW_I2C u8g2(U8G2_R0, / clock=/ SCL, / data=/ SDA, / reset=/ U8X8_PIN_NONE); // Adafruit Feather ESP8266/32u4 Boards + FeatherWing OLED //U8G2_SSD1306_128X32_UNIVISION_1_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE); // Adafruit ESP8266/32u4/ARM Boards + FeatherWing OLED //U8G2_SSD1306_128X32_UNIVISION_1_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE, / clock=/ SCL, / data=/ SDA); // pin remapping with ESP8266 HW I2C //U8G2_SSD1306_128X32_WINSTAR_1_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE, / clock=/ SCL, / data=/ SDA); // pin remapping with ESP8266 HW I2C //U8G2_SSD1306_64X48_ER_1_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE); // EastRising 0.66" OLED breakout board, Uno: A4=SDA, A5=SCL, 5V powered //U8G2_SSD1306_48X64_WINSTAR_1_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE);
//U8G2_SSD1306_64X32_NONAME_1_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE); //U8G2_SSD1306_64X32_1F_1_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE); //U8G2_SSD1306_96X16_ER_1_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE); // EastRising 0.69" OLED //U8G2_SSD1306_72X40_ER_1_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE); // EastRising 0.42" OLED //U8G2_SSD1306_96X40_1_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE); //U8G2_SSD1306_96X39_1_HW_I2C u8g2(U8G2_R0, / reset=/ U8X8_PIN_NONE);

Also, my screen is SSD1309

fatima00ruma commented 1 year ago

The code you gave me, doesn't exist in the library. So it makes errors. I hope we find the solution :)

olikraus commented 1 year ago

Your code in the initial post is wrong (whether it is 1309 or 1306). You must use the "F" (full buffer) constructor instead of the "1" constructor.

It is always worth to read the manuals to find quick solutions: https://github.com/olikraus/u8g2/wiki/u8g2setupcpp#constructor-name

fatima00ruma commented 1 year ago

IT WORKS!!!!! YOU ARE A GENIOUS!!!! thankyou so much