Created
July 4, 2020 22:05
-
-
Save sobuildit/b0ac979126c0e80877c589b0b377c7ea to your computer and use it in GitHub Desktop.
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
from board import SCL, SDA | |
import busio | |
from PIL import Image, ImageDraw | |
import adafruit_ssd1306 | |
# Create the I2C interface. | |
i2c = busio.I2C(SCL, SDA) | |
disp = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c) | |
# Clear display. | |
disp.fill(0) | |
disp.show() | |
# Create blank image for drawing and blank it | |
width = disp.width | |
height = disp.height | |
image = Image.new("1", (width, height)) | |
# Get drawing object to draw on image. | |
draw = ImageDraw.Draw(image) | |
# Draw a black filled box to clear the image. | |
draw.rectangle((0, 0, width, height), outline=0, fill=0) | |
# ... Draw things using PIL ... | |
disp.image(image) | |
disp.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment