From cb877fab417576ef6bbd36b85e265d661e195232 Mon Sep 17 00:00:00 2001 From: Jose Riha Date: Mon, 8 Aug 2022 16:14:51 +0200 Subject: [PATCH] Add setup example for Lolin's I2C OLED shield. --- setup_examples/ssd1306_i2c_esp8266.py | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 setup_examples/ssd1306_i2c_esp8266.py diff --git a/setup_examples/ssd1306_i2c_esp8266.py b/setup_examples/ssd1306_i2c_esp8266.py new file mode 100644 index 0000000..68519fa --- /dev/null +++ b/setup_examples/ssd1306_i2c_esp8266.py @@ -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)