kopia lustrzana https://github.com/peterhinch/micropython-nano-gui
Merge pull request #35 from jose1711/esp8266_i2c_setupexample
Add setup example for Lolin's I2C OLED shield.pull/36/head
commit
2b26eee396
|
@ -0,0 +1,30 @@
|
|||
# esp8266_setup.py Copy to target as color_setup.py
|
||||
|
||||
# Released under the MIT License (MIT). See LICENSE.
|
||||
# Copyright (c) 2020 Peter Hinch
|
||||
|
||||
# As written, supports:
|
||||
# OLED monochromatic display 0.66" 64*48 shield: https://www.wemos.cc/en/latest/d1_mini_shield/oled_0_66.html
|
||||
# Edit the driver import for other displays.
|
||||
|
||||
# WIRING.
|
||||
# - no wiring required if shield placed atop Wemos D1 mini
|
||||
#
|
||||
# ESP SSD
|
||||
# 3.3v 3.3v
|
||||
# Gnd Gnd
|
||||
# GP5 D1 (SCL)
|
||||
# GP4 D2 (SDA)
|
||||
|
||||
import machine
|
||||
import gc
|
||||
from drivers.ssd1306.ssd1306 import SSD1306_I2C as SSD
|
||||
|
||||
gc.collect()
|
||||
|
||||
WIDTH = const(64)
|
||||
HEIGHT = const(48)
|
||||
|
||||
i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4))
|
||||
gc.collect() # Precaution before instantiating framebuf
|
||||
ssd = SSD(WIDTH, HEIGHT, i2c)
|
Ładowanie…
Reference in New Issue