Micropython Utility library for Adafruit 0.96" SSD1306 monochrome OLED Display GFX functions & examples.
- GFX pixel drawing functions for basic shapes (circle, rectangle, lines, frames, triangles)
- Easy setup of an I2C / SPI connection to the display
- Bresenham algorithm for drawing cleaner lines and circles
- Examples
This project was written just for fun and personal use. Altough deprecated Adafruits's GFX Library probably provides better performance.
Your device needs to bet setup for micropython.
If not follow this tutorial from micropython.org.
As development IDE I personally recommend thonny.
This project was written and tested with an ESP32 using an I2C connection but it should work fine on other micropython devices.
The SPI implemenatation is not yet tested.
Keep a copy of ssd1306.py in the same directory.
I2C Device | ESP32 |
---|---|
SDA | SDA default is GPIO 21 |
SCL | SCL default is GPIO 22 |
GND | GND |
VCC | 3.3V and 5V should work |
I2C Device | ESP8266 |
---|---|
SDA | SDA default is GPIO 04 |
SCL | SCL default is GPIO 05 |
GND | GND |
VCC | 3.3V and 5V should work |
please consider contributing to this section...
Keep them in the same directory on the micropython device
The ssd1306_gfx class inherits the methods of the ssd1306.py class.
import ssd1306_gfx
Here I2C: This initializes the I2C connection and the driver class
ssd1306_display = SSD1306_I2C_SETUP(22, 21, 128, 64)
// ssd1306_display = SSD1306_I2C_SETUP(SCL Pin, SDA Pin, display width, display height)
ssd1306_display.triangle( 0, 0, 25 , 0, 25, 63)
ssd1306_display.circle(None, None, None, 3) #Utilizes default values
ssd1306_display.text("Test TEXT", 10, 20, 0)
ssd1306_display.show() #Writes the buffer onto the display
Please feel invited to contribute and improve!