Troubles with SSD1306 OLED


#1

Hi Guys,

Having some troubles getting my OLED display working (SPI OLED SSD1306).
I’ll post my wiring configuration and code below.

Any help would be appreciated!
Thanks!


#2

Being a bit more specific what troubles, wouldn’t harm.
Why not use the hardware SPI interface but go for bitbanging?
Have you looked at the threads that already deal with this display?

BTW, if you want to post code it’s better to actually post the code and not just a screenshot.


#3

Sorry for the brief explanation earlier.

I’m having troubles getting the OLED screen working. As you can see below I have implemented some basic code and included the correct libraries but it still doesn’t work.

My OLED screen seems to have different output pins?

I’ve searched for various tutorial but can’t find anything that works :frowning:

CODE BELOW:

#include "Adafruit_SSD1306/Adafruit_GFX.h"
#include "Adafruit_SSD1306/Adafruit_SSD1306.h"

// Uncomment this block to use hardware SPI
// If using software SPI (the default case):
#define OLED_MOSI   D0
#define OLED_CLK    D1
#define OLED_DC     D2
#define OLED_CS     D3
#define OLED_RESET  D4

Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

void setup() {     
  Serial.begin(9600);
  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC);
  // init done
  display.display(); // show splashscreen
  delay(2000);
  display.clearDisplay();   // clears the screen and buffer
  
  // text display tests
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
  display.println("Hello, world!");
  display.println("");
  display.println("Testing!");
  display.display();
  delay(2000);
}

void loop() {
  
} 


#4

You haven’t addressed my question

The post I linked in my answer above does work but uses the HW SPI pins (in code too) - you should do the same.

You have wired A5 (MOSI) and A3 (SCK) to your display but in your code you use D0 & D1 - didn’t that strike you as odd?
Some minimal sanity check should be possible to expect, shouldn’t it?


#5

@ScruffR After changing some values it’s working now, Thanks!


#6

What did you change?