Skip to content

Instantly share code, notes, and snippets.

Last active November 6, 2022 09:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Display bitmap file on SSD1306/SSD1315 OLED using Raspberry Pi Pico W and CircuitPython
# Display bitmap file on SSD1315 OLED using Raspberry Pi Pico W and CircuitPython
# References and credit to
# -
# Raspberry Pi Pico W
# - [Maker Pi Pico Mini]
# Arduino Grove Sensor Kit for Beginner, OR
# -
# Grove - OLED Display 0.96 inch
# -
# Additional Libraries
# - adafruit_bus_device
# - adafruit_display_text
# - adafruit_displayio_ssd1306.mpy
# Update:
# 6 Nov 2022 - Tested with CircuitPython Pico W 8.0.0-beta.4
import time
import board
import busio
import displayio
import terminalio
from adafruit_display_text import label
import adafruit_displayio_ssd1306
i2c_oled = busio.I2C(scl=board.GP5, sda=board.GP4)
display_bus = displayio.I2CDisplay(i2c_oled, device_address=0x3C)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=64, rotation=180)
# Open the file
with open("/Cytron.bmp", "rb") as bitmap_file:
# Setup the file as the bitmap data source
bitmap = displayio.OnDiskBitmap(bitmap_file)
# Create a TileGrid to hold the bitmap
tile_grid = displayio.TileGrid(
pixel_shader = getattr(
# Create a Group to hold the TileGrid
group = displayio.Group()
# Add the TileGrid to the Group
# Add the Group to the Display
# Loop forever so you can enjoy your image
while True:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment