From 6434022940f08c512c92d2c069c5b50904659179 Mon Sep 17 00:00:00 2001 From: DJDevon3 <49322231+DJDevon3@users.noreply.github.com> Date: Mon, 22 May 2023 13:34:11 -0400 Subject: [PATCH 1/3] Update simpletest with 8.0 standards Includes displayio initiatlization missing from outdated example. This was an issue dealing with support questions related to missing displayio import. Also added height and width ints to make it easier for beginners to change screen sizes as these OLED displays come in a variety of sizes now. --- examples/ssd1306_simpletest.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/ssd1306_simpletest.py b/examples/ssd1306_simpletest.py index 95a6679..9f53c2f 100644 --- a/examples/ssd1306_simpletest.py +++ b/examples/ssd1306_simpletest.py @@ -4,26 +4,26 @@ # Basic example of clearing and drawing pixels on a SSD1306 OLED display. # This example and library is meant to work with Adafruit CircuitPython API. -# Import all board pins. -from board import SCL, SDA +import time +import board import busio - -# Import the SSD1306 module. +import displayio import adafruit_ssd1306 +displayio.release_displays() -# Create the I2C interface. -i2c = busio.I2C(SCL, SDA) +# Create the I2C bus interface. +i2c = board.I2C() # uses board.SCL and board.SDA +# i2c = busio.I2C(board.GP1, board.GP0) # Pi Pico RP2040 # Create the SSD1306 OLED class. -# The first two parameters are the pixel width and pixel height. Change these -# to the right size for your display! -display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c) -# Alternatively you can change the I2C address of the device with an addr parameter: -# display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, addr=0x31) +display_width = 128 +display_height = 32 +display = adafruit_ssd1306.SSD1306_I2C(display_width, display_height, i2c) +# You can change the I2C address with an addr parameter: +# display = adafruit_ssd1306.SSD1306_I2C(display_width, display_height, i2c, addr=0x31) -# Clear the display. Always call show after changing pixels to make the display -# update visible! +# fills display with black pixels clearing it display.fill(0) display.show() From 867eaabeb5248d835967f05d17fea4b2cbdab44f Mon Sep 17 00:00:00 2001 From: DJDevon3 <49322231+DJDevon3@users.noreply.github.com> Date: Mon, 22 May 2023 13:42:22 -0400 Subject: [PATCH 2/3] fixed unused time import pylint complained about the unused import. nice catch pylint! --- examples/ssd1306_simpletest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/ssd1306_simpletest.py b/examples/ssd1306_simpletest.py index 9f53c2f..5999871 100644 --- a/examples/ssd1306_simpletest.py +++ b/examples/ssd1306_simpletest.py @@ -4,7 +4,6 @@ # Basic example of clearing and drawing pixels on a SSD1306 OLED display. # This example and library is meant to work with Adafruit CircuitPython API. -import time import board import busio import displayio From a871c95b34d05969c33f02e6542c1469f6a3ef4c Mon Sep 17 00:00:00 2001 From: DJDevon3 <49322231+DJDevon3@users.noreply.github.com> Date: Mon, 22 May 2023 13:44:21 -0400 Subject: [PATCH 3/3] removed busio import Not sure if this is the right thing to do if the import is part of the optional commented out section. Guess someone will cross that bridge when they get there? --- examples/ssd1306_simpletest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/ssd1306_simpletest.py b/examples/ssd1306_simpletest.py index 5999871..a476f37 100644 --- a/examples/ssd1306_simpletest.py +++ b/examples/ssd1306_simpletest.py @@ -5,7 +5,6 @@ # This example and library is meant to work with Adafruit CircuitPython API. import board -import busio import displayio import adafruit_ssd1306