# micropython-ssd1327 **Repository Path**: waveshare/micropython-ssd1327 ## Basic Information - **Project Name**: micropython-ssd1327 - **Description**: SSD1327 128x128 4位灰度 OLED 显示屏 MicroPython 驱动程序 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-06 - **Last Updated**: 2026-05-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # MicroPython SSD1327 [简体中文](README.zh-CN.md) A MicroPython library for SSD1327 128x128 4-bit greyscale OLED displays, over I2C or SPI. ## Example Copy `ssd1327.py` to your device before running the examples. In Thonny IDE, you can open `ssd1327.py`, choose **File > Save as...**, select **MicroPython device**, and save it as `ssd1327.py`. You can also use Thonny's file view: right-click `ssd1327.py` and upload it to `/` on the device. WebREPL or your usual build and deploy flow will work too. ### I2C Example ```python from machine import Pin, I2C import ssd1327 # ESP32 S3 ZERO i2c = I2C(0, scl=Pin(2), sda=Pin(1), freq=400000) # Raspberry Pi Pico # i2c = I2C(0, scl=Pin(1), sda=Pin(0), freq=400000) # Initialize Display (Address usually 0x3C or 0x3D) display = ssd1327.SSD1327_I2C(128, 128, i2c, addr=0x3D) # WaveShare 1.5inch OLED Module display.fill(0) # Clear screen display.text('Hello World', 0, 0, 15) # Draw text in full brightness (15) display.show() ``` ### SPI Example ```python from machine import Pin, SPI import ssd1327 # ESP32 S3 ZERO spi = SPI(1, baudrate=10000000, polarity=0, phase=0, sck=Pin(13), mosi=Pin(11)) display = ssd1327.SSD1327_SPI(128, 128, spi, dc=Pin(8), res=Pin(9), cs=Pin(10)) display.fill(0) display.text('SPI Display', 0, 0, 15) display.show() ``` ### Using the examples The files in [/examples](/examples) are example snippets that use an already initialized `display` object. To try one, start with either the I2C or SPI setup above, then append the contents of the example file after the `display = ...` line. For example, to use `examples/hello_world.py`, your script should look like this: ```python from machine import Pin, I2C import ssd1327 i2c = I2C(0, scl=Pin(2), sda=Pin(1), freq=400000) display = ssd1327.SSD1327_I2C(128, 128, i2c, addr=0x3D) # Paste the contents of examples/hello_world.py below. display.fill(0) for y in range(0, 12): display.text('Hello World', 0, y * 8, 15 - y) display.show() ``` Save the combined script as `main.py`, or paste it into your REPL or boot script, depending on how you deploy code to your board. Some examples need extra imports before the pasted snippet. For example, `examples/rotating_3d_cube.py` uses `math`, so add `import math` near the top of your script. ## Parts * [WaveShare ESP32-S3 Zero](https://www.waveshare.com/esp32-s3-zero.htm) * [Raspberry Pi Pico](https://core-electronics.com.au/raspberry-pi-pico.html) * [WaveShare 1.5inch OLED Module, SPI/I2C interface](https://www.waveshare.com/1.5inch-oled-module.htm) ## Links * [micropython.org](http://micropython.org) * [micropython docs](http://docs.micropython.org/en/latest/) * [Adafruit Ampy](https://learn.adafruit.com/micropython-basics-load-files-and-run-code/install-ampy) ## License This project is based on [mcauser/micropython-ssd1327](https://github.com/mcauser/micropython-ssd1327), licensed under the MIT License. Licensed under the [MIT License](http://opensource.org/licenses/MIT).