1

Just starting a project and wanting to connect Lolin D32 Pro board with OLED SH1106. The screeen works with my Arduino Nano no problem however I can't seem to get it working on the D32 Pro. I tried different pins on the D32 and different libraries, no luck.

My code example is below and I connect pin 21 of D32 board to the sda pin of the screen and pin 22 of the d32 board to the scl pin of the screen. VCC & GND also are connected correspondingly

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH1106.h>

#define OLED_SDA 21
#define OLED_SCL 22

Adafruit_SH1106 display(21, 22);


void setup()   {                
  Serial.begin(115200);
  Serial.println("setup");
  /* initialize OLED with I2C address 0x3C */
  display.begin(SH1106_SWITCHCAPVCC, 0x3C); 
  Serial.println("begin");
  display.clearDisplay();
  Serial.println("clear");

}
void loop() { 
    Serial.println("loop");

  /* set text size, color, cursor position, 
  set buffer with  Hello world and show off*/
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println("Hello, world!");
  display.display();
  delay(2000);
  display.clearDisplay();
}

Please help me out with the code example or something to read. I suspect I am missing something around D32 Pro board pins

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.