Simple test¶
Ensure your device works with this simple test.
examples/il0373_simpletest.py¶
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 adafruit_il0373
15
16displayio.release_displays()
17
18epd_cs = board.D9
19epd_dc = board.D10
20
21display_bus = displayio.FourWire(
22 board.SPI(), command=epd_dc, chip_select=epd_cs, baudrate=1000000
23)
24time.sleep(1)
25
26display = adafruit_il0373.IL0373(
27 display_bus, width=212, height=104, rotation=90, highlight_color=0xFF0000
28)
29
30g = displayio.Group()
31
32with open("/display-ruler.bmp", "rb") as f:
33 pic = displayio.OnDiskBitmap(f)
34 # CircuitPython 6 & 7 compatible
35 t = displayio.TileGrid(
36 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
37 )
38 # CircuitPython 7 compatible only
39 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
40 g.append(t)
41
42 display.show(g)
43
44 display.refresh()
45
46 print("refreshed")
47
48 time.sleep(120)
Device Specific Examples¶
examples/il0373_1.54_color.py¶
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 adafruit_il0373
15
16displayio.release_displays()
17
18# This pinout works on a Feather M4 and may need to be altered for other boards.
19spi = board.SPI() # Uses SCK and MOSI
20epd_cs = board.D9
21epd_dc = board.D10
22epd_reset = board.D5
23epd_busy = board.D6
24
25display_bus = displayio.FourWire(
26 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
27)
28time.sleep(1)
29
30display = adafruit_il0373.IL0373(
31 display_bus,
32 width=152,
33 height=152,
34 busy_pin=epd_busy,
35 highlight_color=0xFF0000,
36 rotation=180,
37)
38
39g = displayio.Group()
40
41with open("/display-ruler.bmp", "rb") as f:
42 pic = displayio.OnDiskBitmap(f)
43 # CircuitPython 6 & 7 compatible
44 t = displayio.TileGrid(
45 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
46 )
47 # CircuitPython 7 compatible only
48 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
49 g.append(t)
50
51 display.show(g)
52
53 display.refresh()
54
55 print("refreshed")
56
57 time.sleep(120)
examples/il0373_2.9_color.py¶
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 adafruit_il0373
14
15# Used to ensure the display is free in CircuitPython
16displayio.release_displays()
17
18# Define the pins needed for display use
19# This pinout is for a Feather M4 and may be different 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
26# Create the displayio connection to the display pins
27display_bus = displayio.FourWire(
28 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
29)
30time.sleep(1) # Wait a bit
31
32# Create the display object - the third color is red (0xff0000)
33display = adafruit_il0373.IL0373(
34 display_bus,
35 width=296,
36 height=128,
37 rotation=270,
38 busy_pin=epd_busy,
39 highlight_color=0xFF0000,
40)
41
42# Create a display group for our screen objects
43g = displayio.Group()
44
45# Display a ruler graphic from the root directory of the CIRCUITPY drive
46with open("/display-ruler.bmp", "rb") as f:
47 pic = displayio.OnDiskBitmap(f)
48 # Create a Tilegrid with the bitmap and put in the displayio group
49 # CircuitPython 6 & 7 compatible
50 t = displayio.TileGrid(
51 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
52 )
53 # CircuitPython 7 compatible only
54 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
55 g.append(t)
56
57 # Place the display group on the screen
58 display.show(g)
59
60 # Refresh the display to have it actually show the image
61 # NOTE: Do not refresh eInk displays sooner than 180 seconds
62 display.refresh()
63 print("refreshed")
64
65 time.sleep(180)
examples/il0373_2.9_grayscale.py¶
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 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 = busio.SPI(board.SCK, board.MOSI) # Uses SCK and MOSI
21epd_cs = board.D9
22epd_dc = board.D10
23
24display_bus = displayio.FourWire(
25 spi, command=epd_dc, chip_select=epd_cs, baudrate=1000000
26)
27time.sleep(1)
28
29display = adafruit_il0373.IL0373(
30 display_bus,
31 width=296,
32 height=128,
33 rotation=270,
34 black_bits_inverted=False,
35 color_bits_inverted=False,
36 grayscale=True,
37 refresh_time=1,
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.show(g)
53
54 display.refresh()
55
56 print("refreshed")
57
58 time.sleep(120)
examples/il0373_2.13_color.py¶
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 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 = displayio.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=212,
37 height=104,
38 rotation=90,
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.show(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)
examples/il0373_flexible_2.9_monochrome.py¶
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 adafruit_il0373
15
16displayio.release_displays()
17
18# This pinout works on a Feather M4 and may need to be altered for other boards.
19spi = board.SPI() # Uses SCK and MOSI
20epd_cs = board.D9
21epd_dc = board.D10
22epd_reset = board.D5
23epd_busy = board.D6
24
25display_bus = displayio.FourWire(
26 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
27)
28time.sleep(1)
29
30display = adafruit_il0373.IL0373(
31 display_bus, width=296, height=128, rotation=90, busy_pin=epd_busy, swap_rams=True
32)
33
34g = displayio.Group()
35
36with open("/display-ruler.bmp", "rb") as f:
37 pic = displayio.OnDiskBitmap(f)
38 # CircuitPython 6 & 7 compatible
39 t = displayio.TileGrid(
40 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
41 )
42 # CircuitPython 7 compatible only
43 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
44 g.append(t)
45
46 display.show(g)
47
48 display.refresh()
49
50 time.sleep(120)
examples/il0373_2.13_monochrome.py¶
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 adafruit_il0373
15
16displayio.release_displays()
17
18# This pinout works on a Feather M4 and may need to be altered for other boards.
19spi = board.SPI() # Uses SCK and MOSI
20epd_cs = board.D9
21epd_dc = board.D10
22epd_reset = board.D5
23epd_busy = board.D6
24
25display_bus = displayio.FourWire(
26 spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
27)
28time.sleep(1)
29
30display = adafruit_il0373.IL0373(
31 display_bus, width=212, height=104, rotation=90, busy_pin=epd_busy, swap_rams=True
32)
33
34g = displayio.Group()
35
36with open("/display-ruler.bmp", "rb") as f:
37 pic = displayio.OnDiskBitmap(f)
38 # CircuitPython 6 & 7 compatible
39 t = displayio.TileGrid(
40 pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
41 )
42 # CircuitPython 7 compatible only
43 # t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
44 g.append(t)
45
46 display.show(g)
47
48 display.refresh()
49
50 time.sleep(120)