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
13import board
14import displayio
15import adafruit_il0398
16
17displayio.release_displays()
18
19# This pinout works on a Feather M4 and may need to be altered for other boards.
20spi = board.SPI() # Uses SCK and MOSI
21epd_cs = board.D9
22epd_dc = board.D10
23epd_reset = board.D5
24epd_busy = board.D6
25
26display_bus = displayio.FourWire(
27 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
28)
29time.sleep(1)
30
31display = adafruit_il0398.IL0398(
32 display_bus, width=400, height=300, seconds_per_frame=20, busy_pin=epd_busy
33)
34
35g = displayio.Group()
36
37with open("/display-ruler.bmp", "rb") as f:
38 pic = displayio.OnDiskBitmap(f)
39 # CircuitPython 6 & 7 compatible
40 t = displayio.TileGrid(
41 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
42 )
43 # CircuitPython 7 compatible only
44 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
45 g.append(t)
46
47 display.show(g)
48
49 display.refresh()
50
51 time.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
15import board
16import displayio
17import adafruit_il0398
18
19displayio.release_displays()
20
21# This pinout works on a Feather M4 and may need to be altered for other boards.
22spi = board.SPI() # Uses SCK and MOSI
23epd_cs = board.D9
24epd_dc = board.D10
25epd_reset = board.D5
26epd_busy = board.D6
27
28display_bus = displayio.FourWire(
29 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
30)
31time.sleep(1)
32
33display = adafruit_il0398.IL0398(
34 display_bus,
35 width=400,
36 height=300,
37 seconds_per_frame=20,
38 highlight_color=0xFF0000,
39 busy_pin=epd_busy,
40)
41
42g = displayio.Group()
43
44with open("/display-ruler.bmp", "rb") as f:
45 pic = displayio.OnDiskBitmap(f)
46 # CircuitPython 6 & 7 compatible
47 t = displayio.TileGrid(
48 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
49 )
50 # CircuitPython 7 compatible only
51 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
52 g.append(t)
53
54 display.show(g)
55
56 display.refresh()
57
58 time.sleep(120)