Simple test¶
Ensure your device works with this simple test.
examples/ssd1608_simpletest.py¶
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4"""Simple test script for 1.54" 200x200 monochrome display.
5
6Supported products:
7 * Adafruit 1.54" Monochrome ePaper Display Breakout
8 * https://www.adafruit.com/product/4196
9 """
10
11import time
12import board
13import displayio
14import adafruit_ssd1608
15
16displayio.release_displays()
17
18# This pinout works on a Feather M4 and may need to be altered for other boards.
19spi = board.SPI() # Uses SCK and MOSI
20epd_cs = board.D9
21epd_dc = board.D10
22epd_reset = board.D5
23epd_busy = board.D6
24
25display_bus = displayio.FourWire(
26 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
27)
28time.sleep(1)
29
30display = adafruit_ssd1608.SSD1608(
31 display_bus, width=200, height=200, busy_pin=epd_busy, rotation=180
32)
33
34g = displayio.Group()
35
36with open("/display-ruler.bmp", "rb") as f:
37 pic = displayio.OnDiskBitmap(f)
38 # CircuitPython 6 & 7 compatible
39 t = displayio.TileGrid(
40 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
41 )
42 # CircuitPython 7 compatible only
43 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
44 g.append(t)
45
46 display.show(g)
47
48 display.refresh()
49
50 print("refreshed")
51
52 time.sleep(120)