Simple test

Ensure your device works with this simple test.

examples/il0398_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""Simple test script for 4.2" 400x300 black and white displays.
 5
 6Supported products:
 7  * WaveShare 4.2" Black and White
 8    * https://www.waveshare.com/product/modules/oleds-lcds/e-paper/4.2inch-e-paper.htm
 9    * https://www.waveshare.com/product/modules/oleds-lcds/e-paper/4.2inch-e-paper-module.htm
10"""
11
12import time
13
14import board
15import displayio
16from fourwire import FourWire
17
18import adafruit_il0398
19
20displayio.release_displays()
21
22# This pinout works on a Feather M4 and may need to be altered for other boards.
23spi = board.SPI()  # Uses SCK and MOSI
24epd_cs = board.D9
25epd_dc = board.D10
26epd_reset = board.D5
27epd_busy = board.D6
28
29display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
30time.sleep(1)
31
32display = adafruit_il0398.IL0398(
33    display_bus, width=400, height=300, seconds_per_frame=20, busy_pin=epd_busy
34)
35
36g = displayio.Group()
37
38pic = displayio.OnDiskBitmap("/display-ruler.bmp")
39t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
40g.append(t)
41
42display.root_group = g
43
44display.refresh()
45
46time.sleep(120)

Simple test

Ensure your device works with this simple test.

examples/il0398_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""Simple test script for 4.2" 400x300 tri-color displays.
 5
 6Supported products:
 7  * WaveShare 4.2" Color
 8    * https://www.waveshare.com/product/modules/oleds-lcds/e-paper/4.2inch-e-paper-b.htm
 9    * https://www.waveshare.com/product/modules/oleds-lcds/e-paper/4.2inch-e-paper-c.htm
10    * https://www.waveshare.com/product/modules/oleds-lcds/e-paper/4.2inch-e-paper-module-c.htm
11    * https://www.waveshare.com/product/modules/oleds-lcds/e-paper/4.2inch-e-paper-module-b.htm
12"""
13
14import time
15
16import board
17import displayio
18from fourwire import FourWire
19
20import adafruit_il0398
21
22displayio.release_displays()
23
24# This pinout works on a Feather M4 and may need to be altered for other boards.
25spi = board.SPI()  # Uses SCK and MOSI
26epd_cs = board.D9
27epd_dc = board.D10
28epd_reset = board.D5
29epd_busy = board.D6
30
31display_bus = FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)
32time.sleep(1)
33
34display = adafruit_il0398.IL0398(
35    display_bus,
36    width=400,
37    height=300,
38    seconds_per_frame=20,
39    highlight_color=0xFF0000,
40    busy_pin=epd_busy,
41)
42
43g = displayio.Group()
44
45pic = displayio.OnDiskBitmap("/display-ruler.bmp")
46t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
47g.append(t)
48
49display.root_group = g
50
51display.refresh()
52
53time.sleep(120)