-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from eliotg/main
Add example to clear the screen
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# SPDX-FileCopyrightText: Tony DiCola | ||
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
# 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 busio | ||
|
||
# Import the SSD1306 module. | ||
import adafruit_ssd1306 | ||
|
||
|
||
# Create the I2C interface. | ||
i2c = busio.I2C(SCL, SDA) | ||
|
||
# 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) | ||
|
||
# Clear the display. Always call show after changing pixels to make the display | ||
# update visible! | ||
display.fill(0) | ||
display.show() |