I have this ESP8266 Heltec NodeMCU board with OLED. The pins are described here.
I have the following problem. The both OLED (with u8g2) and Wifi work fine individually. There is a problem getting them working together.
In particular, the following code works (and shows Hello World, blanks the screen and then repeats):
#include <U8g2lib.h> U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE); void setup() { u8g2.begin(); } void loop() { u8g2.setFont(u8g2_font_ncenB14_tr); u8g2.firstPage(); do { u8g2.setCursor(0, 20); u8g2.print(F("Hello World!")); } while ( u8g2.nextPage() ); delay(2000); u8g2.clear(); delay(2000); } Adding the Wifi to the code (the only difference to the code above are the 2 lines in the setup).
#include <ESP8266WiFi.h> #include <U8g2lib.h> U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE); void setup() { u8g2.begin(); WiFi.begin ( "xxx", "yyy" ); while ( WiFi.status() != WL_CONNECTED ) {} } void loop() { u8g2.setFont(u8g2_font_ncenB14_tr); u8g2.firstPage(); do { u8g2.setCursor(0, 20); u8g2.print(F("Hello World!")); } while ( u8g2.nextPage() ); delay(2000); u8g2.clear(); delay(2000); } In this case, nothing is visible on the display.