Giter Site home page Giter Site logo

micropython-ssd1306's Introduction

micropython-ssd1306

This is a fork of the driver for SSD1306 displays which is hosted in the Micropython package. 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.

micropython-ssd1306's People

Contributors

stlehmann avatar lurch avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.