Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stlehmann/micropython-ssd1306
A fork of the driver for SSD1306 displays to make it installable via upip
https://github.com/stlehmann/micropython-ssd1306
micropython micropython-driver
Last synced: 6 days ago
JSON representation
A fork of the driver for SSD1306 displays to make it installable via upip
- Host: GitHub
- URL: https://github.com/stlehmann/micropython-ssd1306
- Owner: stlehmann
- License: mit
- Created: 2018-11-18T16:57:39.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-08T08:17:34.000Z (almost 2 years ago)
- Last Synced: 2024-12-05T10:50:38.736Z (17 days ago)
- Topics: micropython, micropython-driver
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 130
- Watchers: 6
- Forks: 42
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# micropython-ssd1306
This is a fork of the driver for SSD1306 displays which is hosted in the
[Micropython package](https://github.com/micropython/micropython). The purpose
of this fork is to make the driver available on PyPi and thus installable via
the upip package manager.## Installation
Use the upip package manager:upip.install('micropython-ssd1306')
If your board or your computer doesn't have an active internet connection you
can also clone this project on your local drive and copy the *ssd1306.py* to
your board.## Example Usage
This shows an example usage on an *ESP32* board with an *SSD1306* display
with an resolution of 128x32 pixels. The display is connected via I2C. On the
*ESP32* the I2C pins are: SDA: 23, SCL: 22.First we set up the I2C bus on our *ESP32* and scan for devices.
>>> import machine
>>> i2c = machine.I2C(sda=machine.Pin(23), scl=machine.Pin(22))
>>> i2c.scan()
[60]This shows us that there is a device on address 60 which is 3C in Hex. That is
where our display is supposed to live. Now we create an object for our OLED
display.>>> from ssd1306 import SSD1306_I2C
>>> oled = SSD1306_I2C(128, 32, i2c)This is it. Now we can use our OLED display:
>>> oled.fill(1)
>>> oled.show()This fills the whole display with white pixels. To clear the display do:
>>> oled.fill(0)
>>> oled.show()Now we can also write some text:
>>> oled.text('Hello', 0, 0)
>>> oled.text('World', 0, 10)
>>> oled.show()Find more information on how to use the SSD1306 on the great [tutorial about
the OLED featherwing from Adafruit](https://learn.adafruit.com/adafruit-oled-featherwing/circuitpython#usage-6-4).