and a OLED Display SSD1306 SPI 0,96 128x64 Pixel (ebay.de)
I have tried to learn it myself. But I do not find on the Internet the correct instructions. Have Instructions for displays with 7 pins but not with 6 as in my case.
The OLED Display SSD1306 SPI have the following PINs:
DC
RES
D1
D0
VCC
GRD
Can someone please be so nice and explain to me how connect the cable?
First question: does your display match the Ebay photos exactly?
Second question: does your display look a badly scratched?
I am fascinated by these "6-pin" SSD1306 modules.
They seem to have SPI pins but no CS.
I suspect that they default to I2C. (probably with no ACK)
Connect RES to VCC (via a 10k resistor)
Connect DC to 0V for Slave=0x3C (or VCC via 10k for Slave=0x3D)
Connect D0 to SCL
Connect D1 to SDA
Connect GND to 0V
Connect VCC to 3.3V (or 5V)
David.
p.s. if you are using Adafruit_SSD1306 library, the I2C constructor asks for a RESET pin. If you have a spare pin, you can use GPIO instead of connecting RES to VCC.
If you have the SPI version of the display as advertised then this portion of a working sketch tells you how I connect the display to the NodeMCU:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// If using SPI:
// Connect NodeMCU GND to display GND
// Connect NodeMCU 3V3 to display VCC
#define OLED_SDIN D7 //MOSI (Connect to display D1 or SDA)
#define OLED_SCLK D5 //SCLK (Connect to display D0 or SCL)
#define OLED_DC D4 //Connect to display DC
#define OLED_RST D3 //Connect to display RES
#define OLED_CS D0 //Not connected to display, use a spare pin (e.g. D0 is NodeMCU LED)
// this is the constructor to use for hardware SPI pins as specfied above
Adafruit_SSD1306 display(OLED_DC, OLED_RST, OLED_CS);
// this is the constructor to use for software SPI with different pin allocations
//Adafruit_SSD1306 display(OLED_SDIN,OLED_SCLK, OLED_DC, OLED_RST, OLED_CS);
Make sure you have the latest versions of the Adafruit_GFX and Adafruit_SSD1306 libraries off Github loaded as some IDE versions do not pull in the latest version and some versions produce errors when used with a NodeMCU.
Other SSD1306 and NodeMCU compatible libraries are available.