Simple test
Ensure your device works with this simple test.
examples/uc8179_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 5.83" 648x480 monochrome display (ThinkInk_583_Mono_AAAMFGN)."""
7
8import time
9
10import board
11import busio
12import displayio
13from fourwire import FourWire
14
15import adafruit_uc8179
16
17displayio.release_displays()
18
19# This pinout works on a MagTag with the newer screen and may need to be altered for other boards.
20spi = busio.SPI(board.EPD_SCK, board.EPD_MOSI) # Uses SCK and MOSI
21epd_cs = board.EPD_CS
22epd_dc = board.EPD_DC
23epd_reset = board.EPD_RESET
24epd_busy = board.EPD_BUSY
25
26display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
27time.sleep(1)
28
29display = adafruit_uc8179.UC8179(
30 display_bus,
31 width=648,
32 height=480,
33 busy_pin=epd_busy,
34 rotation=180,
35 black_bits_inverted=True,
36 colstart=0,
37)
38
39g = displayio.Group()
40
41pic = displayio.OnDiskBitmap("/display-ruler-1280x720.bmp")
42t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
43g.append(t)
44
45display.root_group = g
46
47display.refresh()
48
49print("refreshed")
50
51time.sleep(display.time_to_refresh + 5)
52# Always refresh a little longer. It's not a problem to refresh
53# a few seconds more, but it's terrible to refresh too early
54# (the display will throw an exception when if the refresh
55# is too soon)
56print("waited correct time")
57
58
59# Keep the display the same
60while True:
61 time.sleep(10)