Unsuccessful to connect LCD 12864 ST7920 to NodeMCU ESP8266 module

Hello,
I am referring to this subject

How to connect LCD 12864 ST7920 to NodeMCU ESP8266 module?

tried this but it always blue screen and there is no "Hello World" or any other text that i wrote in the code.

Is it a problem with the code or something with a wire connection?
I connect everithing like in schema except VCC => 5V, because ESP8266 doesn't have 5v, only 3V.

this is my code:

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

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

//U8G2_ST7920_128X64_1_HW_SPI u8g2(U8G2_R0,D8);
U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0, /* clock=/ 14, / data=/ 13, / CS=*/ 15);

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

uint8_t m = 24;

void loop(void) {
  char m_str[3];
  strcpy(m_str, u8x8_u8toa(m, 2));		/* convert m to a string with two digits */
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_logisoso62_tn);
    u8g2.drawStr(0,63,"9");
    u8g2.drawStr(33,63,":");
    u8g2.drawStr(50,63,m_str);
  } while ( u8g2.nextPage() );
  delay(1000);
  m++;
  if ( m == 60 )
    m = 0;
}

I tried this as well:

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);  
}

Do I need to select some other display?

Hello! I got a code from this forum, and I think your's is from that place as well. You see, in the instruction line, your ports are commented (just CS port appears as 15). Also, If you correct this, maybe just one bit of the sreen will show up. To fix this, in the instruction line, instead of U8G2_ST7920_128X64_1_SW_SPI should be: U8G2_ST7920_128X64_F_SW_SPI.
In the end, your code should be like this:
ps: I commented a instruction line for ESP32 as well, if anyone whants to give it a try...

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

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

U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, /* D5clock=*/ 14, /* D7data=*/ 13, /* D8CS=*/  15); // ESP8266
//U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18, /* data=*/ 23, /* CS=*/ 5); // ESP32

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

uint8_t m = 24;

void loop(void) {
  char m_str[3];
  strcpy(m_str, u8x8_u8toa(m, 2));		/* convert m to a string with two digits */
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_logisoso62_tn);
    u8g2.drawStr(0,63,"9");
    u8g2.drawStr(33,63,":");
    u8g2.drawStr(50,63,m_str);
  } while ( u8g2.nextPage() );
  delay(1000);
  m++;
  if ( m == 60 )
    m = 0;
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.