Simple test
Ensure your device works with this simple test.
examples/ssd1683_simpletest.py
1# SPDX-FileCopyrightText: 2025 Scott Shawcroft, written for Adafruit Industries
2# SPDX-FileCopyrightText: Copyright (c) 2021 Melissa LeBlanc-Williams for Adafruit Industries
3#
4# SPDX-License-Identifier: Unlicense
5
6"""Simple test script for 4.2" 400x300 monochrome display (ThinkInk_420_Grayscale4_MFGN)."""
7
8import time
9
10import board
11import busio
12import displayio
13from fourwire import FourWire
14
15import adafruit_ssd1683
16
17displayio.release_displays()
18
19if "EPD_MOSI" in dir(board): # Feather RP2040 ThinkInk
20 spi = busio.SPI(board.EPD_SCK, MOSI=board.EPD_MOSI, MISO=None)
21 epd_cs = board.EPD_CS
22 epd_dc = board.EPD_DC
23 epd_reset = board.EPD_RESET
24 epd_busy = board.EPD_BUSY
25else:
26 spi = board.SPI() # Uses SCK and MOSI
27 epd_cs = board.D9
28 epd_dc = board.D10
29 epd_reset = board.D8 # Set to None for FeatherWing
30 epd_busy = board.D7 # Set to None for FeatherWing
31
32display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
33time.sleep(1)
34
35display = adafruit_ssd1683.SSD1683(display_bus, width=400, height=300, busy_pin=epd_busy)
36
37g = displayio.Group()
38
39pic = displayio.OnDiskBitmap("/display-ruler-1280x720.bmp")
40t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
41g.append(t)
42
43display.root_group = g
44
45display.refresh()
46
47print("refreshed")
48
49time.sleep(display.time_to_refresh + 5)
50# Always refresh a little longer. It's not a problem to refresh
51# a few seconds more, but it's terrible to refresh too early
52# (the display will throw an exception when if the refresh
53# is too soon)
54print("waited correct time")
55
56# Keep the display the same
57while True:
58 time.sleep(10)