This driver depends on:
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally
pip3 install adafruit-circuitpython-ssd1306
To install system-wide (this may be required in some cases): To install in a virtual environment in your current project: More examples and details can be found in the Contributing
Contributions are welcome! Please read our Documentation
For information on building library documentation, please check out
sudo pip3 install adafruit-circuitpython-ssd1306
mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install adafruit-circuitpython-ssd1306
Usage Example
# Basic example of clearing and drawing pixels on a SSD1306 OLED display.
# This example and library is meant to work with Adafruit CircuitPython API.
# Author: Tony DiCola
# License: Public Domain
# Import all board pins.
from board import SCL, SDA
import busio
# Import the SSD1306 module.
import adafruit_ssd1306
# Create the I2C interface.
i2c = busio.I2C(SCL, SDA)
# Create the SSD1306 OLED class.
# The first two parameters are the pixel width and pixel height. Change these
# to the right size for your display!
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
# Alternatively you can change the I2C address of the device with an addr parameter:
#display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, addr=0x31)
# Clear the display. Always call show after changing pixels to make the display
# update visible!
display.fill(0)
display.show()