Skip to content

Commit 81f991a

Browse files
authored
Merge pull request #10 from makermelissa/master
Add reset pin to examples
2 parents 6631f50 + 1ef2f61 commit 81f991a

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

examples/ssd1305_simpletest.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# Import all board pins.
2-
from board import SCL, SDA
2+
from board import SCL, SDA, D4
33
import busio
4+
import digitalio
45

56
# Import the SSD1305 module.
67
import adafruit_ssd1305
78

9+
# Define the Reset Pin
10+
oled_reset = digitalio.DigitalInOut(D4)
11+
812
# Create the I2C interface.
913
i2c = busio.I2C(SCL, SDA)
1014

1115
# Create the SSD1305 OLED class.
1216
# The first two parameters are the pixel width and pixel height. Change these
1317
# to the right size for your display!
14-
display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c)
18+
display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, addr=0x3C, reset=oled_reset)
1519

1620
# Alternatively you can change the I2C address of the device with an addr parameter:
17-
# display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, addr=0x31)
21+
# display = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, addr=0x31, reset=oled_reset)
1822

1923
# Clear the display. Always call show after changing pixels to make the display
2024
# update visible!

examples/ssd1305_stats.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,22 @@
2626

2727
import time
2828
import subprocess
29-
30-
from board import SCL, SDA
29+
from board import SCL, SDA, D4
3130
import busio
31+
import digitalio
3232
from PIL import Image, ImageDraw, ImageFont
3333
import adafruit_ssd1305
3434

35+
# Define the Reset Pin
36+
oled_reset = digitalio.DigitalInOut(D4)
3537

3638
# Create the I2C interface.
3739
i2c = busio.I2C(SCL, SDA)
3840

3941
# Create the SSD1305 OLED class.
4042
# The first two parameters are the pixel width and pixel height. Change these
4143
# to the right size for your display!
42-
disp = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c)
44+
disp = adafruit_ssd1305.SSD1305_I2C(128, 32, i2c, reset=oled_reset)
4345

4446
# Clear display.
4547
disp.fill(0)

0 commit comments

Comments
 (0)