Skip to content

zhcong/SSD1306-for-ESP32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSD1306 for ESP32

I didn't find the relevant driver on my board. But I find it in MicroPython‘s official code. Here's the link, you can just download this .py file. But it doesn't work good in my ESP32 board. My board is NodeMCU's ESP-32sjust like left picture and right is my SSD1306 OLED screen:
ESP-32s ESP-32s

use Screen.py

Screen.py just copy this and modify a little.See a example:

from machine import Pin,SPI
import Screen
import time

power=Pin(13,Pin.OUT)
power.value(1)
spi=SPI(1,sck=Pin(18,Pin.OUT),mosi=Pin(5,Pin.OUT),baudrate=24000000)

# width:128, height:64, dc-->pin16, res-->pin17
s = Screen.create(128, 64, spi, Pin(16,Pin.OUT), Pin(17,Pin.OUT))
s.print('Hello, world.')

I just add a function print, it work like print in python, Other features in this. What's more, I remove the cs in official code. Because my screen's CS has ground. So pin_13 is vcc, pin_18 is SCL, pin_5 is SDA, pin_16 is D/C, pin_17 is RST. Gif of function print as follows.
ESP-32s
Another, _Screen must create twice and I don't know why, you can see in function Screen, this may cause by error command, but I haveno time to learn SSD1306's command, this pdf will help you. My ESP32 board only costs ¥22($3) in taobao.com and screen costs ¥13($1.8). Cheap!

About

SSD1306 for ESP32 in MicroPython

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages