-
Notifications
You must be signed in to change notification settings - Fork 40
MicroPython: SDD1306
Leo Vidarte edited this page Mar 7, 2017
·
2 revisions
The SDD1306 is a driver for Oled Displays.
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)
ESP8266 NodeMCU Workshop - 2017