From 1ef2f61c7ce239eee0a2f178c59db0edf1f1dc9e Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 1 Jul 2020 10:00:45 -0700 Subject: [PATCH] Add reset pin to examples --- examples/ssd1305_simpletest.py | 10 +++++++--- examples/ssd1305_stats.py | 8 +++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/ssd1305_simpletest.py b/examples/ssd1305_simpletest.py index b7221b0..78adc7e 100644 --- a/examples/ssd1305_simpletest.py +++ b/examples/ssd1305_simpletest.py @@ -1,20 +1,24 @@ # Import all board pins. -from board import SCL, SDA +from board import SCL, SDA, D4 import busio +import digitalio # Import the SSD1305 module. import adafruit_ssd1305 +# Define the Reset Pin +oled_reset = digitalio.DigitalInOut(D4) + # Create the I2C interface. i2c = busio.I2C(SCL, SDA) # Create the SSD1305 OLED class. # The first two parameters are the pixel width and pixel height. Change these # to the right size for your display! -display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c) +display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, addr=0x3C, reset=oled_reset) # Alternatively you can change the I2C address of the device with an addr parameter: -# display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, addr=0x31) +# display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, addr=0x31, reset=oled_reset) # Clear the display. Always call show after changing pixels to make the display # update visible! diff --git a/examples/ssd1305_stats.py b/examples/ssd1305_stats.py index 01e1ecc..8964972 100644 --- a/examples/ssd1305_stats.py +++ b/examples/ssd1305_stats.py @@ -26,12 +26,14 @@ import time import subprocess - -from board import SCL, SDA +from board import SCL, SDA, D4 import busio +import digitalio from PIL import Image, ImageDraw, ImageFont import adafruit_ssd1305 +# Define the Reset Pin +oled_reset = digitalio.DigitalInOut(D4) # Create the I2C interface. i2c = busio.I2C(SCL, SDA) @@ -39,7 +41,7 @@ # Create the SSD1305 OLED class. # The first two parameters are the pixel width and pixel height. Change these # to the right size for your display! -disp = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c) +disp = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, reset=oled_reset) # Clear display. disp.fill(0)