Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4"""Simple test script for 2.13" 212x104 tri-color featherwing.
5
6Supported products:
7 * Adafruit 2.13" Tri-Color FeatherWing
8 * https://www.adafruit.com/product/4128
9 """
10
11import time
12import board
13import displayio
14import fourwire
15import adafruit_il0373
16
17displayio.release_displays()
18
19epd_cs = board.D9
20epd_dc = board.D10
21
22display_bus = fourwire.FourWire(
23 board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000
24)
25time.sleep(1)
26
27display = adafruit_il0373.IL0373(
28 display_bus, width=212, height=104, rotation=90, highlight_color=0xFF0000
29)
30
31g = displayio.Group()
32
33with open("/display-ruler.bmp", "rb") as f:
34 pic = displayio.OnDiskBitmap(f)
35 # CircuitPython 6 & 7 compatible
36 t = displayio.TileGrid(
37 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
38 )
39 # CircuitPython 7 compatible only
40 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
41 g.append(t)
42
43 display.root_group = g
44
45 display.refresh()
46
47 print("refreshed")
48
49 time.sleep(120)
Device Specific Examples¶
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4"""Simple test script for 1.54" 152x152 tri-color display.
5
6Supported products:
7 * Adafruit 1.54" Tri-Color Display Breakout
8 * https://www.adafruit.com/product/3625
9 """
10
11import time
12import board
13import displayio
14import fourwire
15import adafruit_il0373
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 = fourwire.FourWire(
27 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
28)
29time.sleep(1)
30
31display = adafruit_il0373.IL0373(
32 display_bus,
33 width=152,
34 height=152,
35 busy_pin=epd_busy,
36 highlight_color=0xFF0000,
37 rotation=180,
38)
39
40g = displayio.Group()
41
42with open("/display-ruler.bmp", "rb") as f:
43 pic = displayio.OnDiskBitmap(f)
44 # CircuitPython 6 & 7 compatible
45 t = displayio.TileGrid(
46 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
47 )
48 # CircuitPython 7 compatible only
49 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
50 g.append(t)
51
52 display.root_group = g
53
54 display.refresh()
55
56 print("refreshed")
57
58 time.sleep(120)
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4"""Simple test script for Adafruit 2.9" 296x128 tri-color display
5Supported products:
6 * Adafruit 2.9" Tri-Color Display Breakout
7 * https://www.adafruit.com/product/1028
8"""
9
10import time
11import board
12import displayio
13import fourwire
14import adafruit_il0373
15
16# Used to ensure the display is free in CircuitPython
17displayio.release_displays()
18
19# Define the pins needed for display use
20# This pinout is for a Feather M4 and may be different for other boards
21spi = board.SPI() # Uses SCK and MOSI
22epd_cs = board.D9
23epd_dc = board.D10
24epd_reset = board.D5
25epd_busy = board.D6
26
27# Create the displayio connection to the display pins
28display_bus = fourwire.FourWire(
29 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
30)
31time.sleep(1) # Wait a bit
32
33# Create the display object - the third color is red (0xff0000)
34display = adafruit_il0373.IL0373(
35 display_bus,
36 width=296,
37 height=128,
38 rotation=270,
39 busy_pin=epd_busy,
40 highlight_color=0xFF0000,
41)
42
43# Create a display group for our screen objects
44g = displayio.Group()
45
46# Display a ruler graphic from the root directory of the CIRCUITPY drive
47with open("/display-ruler.bmp", "rb") as f:
48 pic = displayio.OnDiskBitmap(f)
49 # Create a Tilegrid with the bitmap and put in the displayio group
50 # CircuitPython 6 & 7 compatible
51 t = displayio.TileGrid(
52 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
53 )
54 # CircuitPython 7 compatible only
55 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
56 g.append(t)
57
58 # Place the display group on the screen
59 display.root_group = g
60
61 # Refresh the display to have it actually show the image
62 # NOTE: Do not refresh eInk displays sooner than 180 seconds
63 display.refresh()
64 print("refreshed")
65
66 time.sleep(180)
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4"""Simple test script for 2.9" 296x128 grayscale display.
5
6Supported products:
7 * Adafruit 2.9" Grayscale
8 * https://www.adafruit.com/product/4777
9 """
10
11import time
12import busio
13import board
14import displayio
15import fourwire
16import adafruit_il0373
17
18displayio.release_displays()
19
20# This pinout works on a Feather M4 and may need to be altered for other boards.
21spi = busio.SPI(board.SCK, board.MOSI) # Uses SCK and MOSI
22epd_cs = board.D9
23epd_dc = board.D10
24
25display_bus = fourwire.FourWire(
26 spi, command=epd_dc, chip_select=epd_cs, baudrate=1000000
27)
28time.sleep(1)
29
30display = adafruit_il0373.IL0373(
31 display_bus,
32 width=296,
33 height=128,
34 rotation=270,
35 black_bits_inverted=False,
36 color_bits_inverted=False,
37 grayscale=True,
38 refresh_time=1,
39)
40
41g = displayio.Group()
42
43with open("/display-ruler.bmp", "rb") as f:
44 pic = displayio.OnDiskBitmap(f)
45 # CircuitPython 6 & 7 compatible
46 t = displayio.TileGrid(
47 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
48 )
49 # CircuitPython 7 compatible only
50 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
51 g.append(t)
52
53 display.root_group = g
54
55 display.refresh()
56
57 print("refreshed")
58
59 time.sleep(120)
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4"""Simple test script for Adafruit 2.13" 212x104 tri-color display
5Supported products:
6 * Adafruit 2.13" Tri-Color Display Breakout
7 * https://www.adafruit.com/product/4086 (breakout) or
8 * https://www.adafruit.com/product/4128 (FeatherWing)
9"""
10
11import time
12import board
13import displayio
14import fourwire
15import adafruit_il0373
16
17# Used to ensure the display is free in CircuitPython
18displayio.release_displays()
19
20# Define the pins needed for display use
21# This pinout is for a Feather M4 and may be different 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
28# Create the displayio connection to the display pins
29display_bus = fourwire.FourWire(
30 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
31)
32time.sleep(1) # Wait a bit
33
34# Create the display object - the third color is red (0xff0000)
35display = adafruit_il0373.IL0373(
36 display_bus,
37 width=212,
38 height=104,
39 rotation=90,
40 busy_pin=epd_busy,
41 highlight_color=0xFF0000,
42)
43
44# Create a display group for our screen objects
45g = displayio.Group()
46
47# Display a ruler graphic from the root directory of the CIRCUITPY drive
48with open("/display-ruler.bmp", "rb") as f:
49 pic = displayio.OnDiskBitmap(f)
50 # Create a Tilegrid with the bitmap and put in the displayio group
51 # CircuitPython 6 & 7 compatible
52 t = displayio.TileGrid(
53 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
54 )
55 # CircuitPython 7 compatible only
56 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
57 g.append(t)
58
59 # Place the display group on the screen
60 display.root_group = g
61
62 # Refresh the display to have it actually show the image
63 # NOTE: Do not refresh eInk displays sooner than 180 seconds
64 display.refresh()
65 print("refreshed")
66
67 time.sleep(180)
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4"""Simple test script for 2.9" 296x128 monochrome display.
5
6Supported products:
7 * Adafruit Flexible 2.9" Monochrome
8 * https://www.adafruit.com/product/4262
9 """
10
11import time
12import board
13import displayio
14import fourwire
15import adafruit_il0373
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 = fourwire.FourWire(
27 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
28)
29time.sleep(1)
30
31display = adafruit_il0373.IL0373(
32 display_bus, width=296, height=128, rotation=90, busy_pin=epd_busy, swap_rams=True
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.root_group = g
48
49 display.refresh()
50
51 time.sleep(120)
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4"""Simple test script for 2.13" 212x104 monochrome display.
5
6Supported products:
7 * Adafruit Flexible 2.13" Monochrome
8 * https://www.adafruit.com/product/4243
9 """
10
11import time
12import board
13import displayio
14import fourwire
15import adafruit_il0373
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 = fourwire.FourWire(
27 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
28)
29time.sleep(1)
30
31display = adafruit_il0373.IL0373(
32 display_bus, width=212, height=104, rotation=90, busy_pin=epd_busy, swap_rams=True
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.root_group = g
48
49 display.refresh()
50
51 time.sleep(120)