MicroPython: SDD1306 - lvidarte/esp8266 GitHub Wiki

The SDD1306 is a driver for Oled Displays.

https://raw.githubusercontent.com/lvidarte/esp8266/master/examples/sdd1306/sdd1306.png

Get the library and upload

$ wget https://raw.githubusercontent.com/adafruit/micropython-adafruit-ssd1306/master/ssd1306.py
$ ampy -p /dev/ttyUSB0 put ssd1306.py

Then check the files on the esp

$ ampy -p /dev/ttyUSB0 ls
boot.py
ssd1306.py

Now, lets play

>>> from machine import Pin, I2C
>>> i2c = I2C(scl=Pin(5), sda=Pin(4))

>>> from ssd1306 import SSD1306_I2C
>>> oled = SSD1306_I2C(128, 64, i2c)

>>> oled.fill(1)
>>> oled.show()
>>> oled.fill(0)
>>> oled.show()


>>> oled.pixel(0, 0, 1)
>>> oled.show()
>>> oled.pixel(127, 63, 1)
>>> oled.show()

>>> oled.text('Hello', 0, 0)
>>> oled.text(‘World’, 0, 10)
>>> oled.show()

>>> oled.invert(True)
>>> oled.invert(False)