Ensure your device works with this simple test.
examples/rgb_display_simpletest.py1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2# SPDX-License-Identifier: MIT 3 4# Quick test of TFT FeatherWing (ST7789) with Feather M0 or M4 5# This will work even on a device running displayio 6# Will fill the TFT black and put a red pixel in the center, wait 2 seconds, 7# then fill the screen blue (with no pixel), wait 2 seconds, and repeat. 8import random 9import time 10 11import board 12import digitalio 13 14from adafruit_rgb_display import st7789 15from adafruit_rgb_display.rgb import color565 16 17# Configuratoin for CS and DC pins (these are FeatherWing defaults on M0/M4): 18cs_pin = digitalio.DigitalInOut(board.D5) 19dc_pin = digitalio.DigitalInOut(board.D6) 20reset_pin = digitalio.DigitalInOut(board.D9) 21 22# Config for display baudrate (default max is 24mhz): 23BAUDRATE = 24000000 24 25# Setup SPI bus using hardware SPI: 26spi = board.SPI() 27 28# Create the ST7789 display: 29display = st7789.ST7789(spi, cs=cs_pin, dc=dc_pin, rst=reset_pin, baudrate=BAUDRATE) 30 31# Main loop: 32while True: 33 # Fill the screen red, green, blue, then black: 34 for color in ((255, 0, 0), (0, 255, 0), (0, 0, 255)): 35 display.fill(color565(color)) 36 # Clear the display 37 display.fill(0) 38 # Draw a red pixel in the center. 39 display.pixel(display.width // 2, display.height // 2, color565(255, 0, 0)) 40 # Pause 2 seconds. 41 time.sleep(2) 42 # Clear the screen a random color 43 display.fill(color565(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))) 44 # Pause 2 seconds. 45 time.sleep(2)examples/rgb_display_ili9341test.py
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries 2# SPDX-License-Identifier: MIT 3 4# Quick test of TFT FeatherWing (ILI9341) with Feather M0 or M4 5# Will fill the TFT black and put a red pixel in the center, wait 2 seconds, 6# then fill the screen blue (with no pixel), wait 2 seconds, and repeat. 7import random 8import time 9 10import board 11import busio 12import digitalio 13 14from adafruit_rgb_display import ili9341 15from adafruit_rgb_display.rgb import color565 16 17# Configuratoin for CS and DC pins (these are FeatherWing defaults on M0/M4): 18cs_pin = digitalio.DigitalInOut(board.D9) 19dc_pin = digitalio.DigitalInOut(board.D10) 20 21# Config for display baudrate (default max is 24mhz): 22BAUDRATE = 24000000 23 24# Setup SPI bus using hardware SPI: 25spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO) 26 27# Create the ILI9341 display: 28display = ili9341.ILI9341(spi, cs=cs_pin, dc=dc_pin, baudrate=BAUDRATE) 29 30# Main loop: 31while True: 32 # Fill the screen red, green, blue, then black: 33 for color in ((255, 0, 0), (0, 255, 0), (0, 0, 255)): 34 display.fill(color565(color)) 35 # Clear the display 36 display.fill(0) 37 # Draw a red pixel in the center. 38 display.pixel(display.width // 2, display.height // 2, color565(255, 0, 0)) 39 # Pause 2 seconds. 40 time.sleep(2) 41 # Clear the screen a random color 42 display.fill(color565(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))) 43 # Pause 2 seconds. 44 time.sleep(2)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4