ESP32-C3(NodeMCU ESP-C3-32S-Kit) drive SSD1331 SPI Color OLED, in arduino-esp32 framework.
This video show how to drive 0.95 inch 96x64 SSD1331 SPI Color OLED
with NodeMCU ESP-C3-32S-Kit
in arduino-esp32 framework.
Install "Adafruit SSD1331 OLED Driver Library for Arduino" in Arduino IDE Library Manager. It support both hardware and software SPI interface to SSD1331.
In arduino-esp32, the hardware SPI pins of "ESP32C3 DevModule" are pre-defined at:
SS : 7
MOSI: 6
MISO: 5
SCK : 4
ref: Last post -
Get ESP32-C3 chip info and predefined pins (arduino-esp32)
But on AI Thinker NodeMCU ESP-C3-32S-Kit, the LEDs connect to:
LED_R: IO3
LED_G: IO4
LED_B: IO5
LED_Cool: IO19
LED_Warm: IO18
ref: ESP-C3-32S-Kit SpecificationSo I use software SPI to interface with SPI SSD1331 Color OLED.
Connection between NodeMCU ESP-C3-32S-Kit and SPI SSD1331 Color OLED
(software SPI)
SSD1331 ESP32C3
-------------------
GND GND
VCC 3V3
SCL IO10
SDA IO9
RES IO8
DC IO7
CS IO6
Open test example of "Adafruit SSD1331 OLED Driver Library for Arduino", and modified as shown here:
.
.
.
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1331.h>
#include <SPI.h>
// You can use any (4 or) 5 pins
#define sclk 10
#define mosi 9
#define cs 6
#define rst 8
#define dc 7
// Color definitions
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
// Option 1: use any pins but a little slower
Adafruit_SSD1331 display = Adafruit_SSD1331(cs, dc, mosi, sclk, rst);
// Option 2: must use the hardware SPI pins
// (for UNO thats sclk = 13 and sid = 11) and pin 10 must be
// an output. This is much faster - also required if you want
// to use the microSD card (see the image drawing example)
//Adafruit_SSD1331 display = Adafruit_SSD1331(&SPI, cs, dc, rst);
float p = 3.1415926;
.
.
.
Comments
Post a Comment