Skip to content

Commit 20022be

Browse files
committed
Pimoroni Display Pack examples - show how to control backlight
1 parent b069295 commit 20022be

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

examples/st7789_240x135_simpletest_Pimoroni_Pico_Display_Pack.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
22
# SPDX-License-Identifier: MIT
33

4+
"""
5+
This test will initialize the display using displayio and draw a solid green
6+
background, a smaller purple rectangle, and some yellow text.
7+
"""
48
import board
59
import busio
610
import terminalio
@@ -30,12 +34,17 @@
3034
spi_mosi = board.GP19
3135
spi_clk = board.GP18
3236
spi = busio.SPI(spi_clk, spi_mosi)
37+
backlight = board.GP20
3338

3439
display_bus = FourWire(spi, command=tft_dc, chip_select=tft_cs)
40+
3541
display = ST7789(
36-
display_bus, rotation=270, width=240, height=135, rowstart=40, colstart=53
42+
display_bus, rotation=270, width=240, height=135, rowstart=40, colstart=53, backlight_pin=backlight
3743
)
3844

45+
# Set the backlight
46+
display.brightness = 0.8
47+
3948
# Make the display context
4049
splash = displayio.Group()
4150
display.root_group = splash

examples/st7789_320x240_simpletest_Pimoroni_Pico_Display_2_0.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
display_bus, rotation=270, width=320, height=240, backlight_pin=backlight
3636
)
3737

38+
# Set the backlight
39+
display.brightness = 0.8
40+
3841
# Make the display context
3942
splash = displayio.Group()
4043
display.root_group = splash

0 commit comments

Comments
 (0)