Created
February 16, 2019 20:58
-
-
Save bmidgley/ab61b9a54f0a03af806f05e919b35d59 to your computer and use it in GitHub Desktop.
ssd1306 python
This file contains hidden or 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
#!/usr/bin/env python | |
# pip install Adafruit-GPIO Adafruit-PureIO Adafruit-SSD1306 | |
import time | |
import Adafruit_GPIO.SPI as SPI | |
import Adafruit_SSD1306 | |
from PIL import Image | |
RST = 24 | |
DC = 23 | |
SPI_PORT = 0 | |
SPI_DEVICE = 0 | |
disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST, dc=DC, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=8000000)) | |
disp.begin() | |
disp.clear() | |
disp.display() | |
image = Image.open('happycat_oled_64.ppm').convert('1') | |
disp.image(image) | |
disp.display() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment