My components being used:
- 5.0 40-pin 800x480 TFT Display without Touchscreen (https://www.electromaker.io/shop/product/50-40-pin-800x480-tft-display-without-touchscreen?srsltid=AR57-fCLOkHp9gyNyF16SiEm-6TbVz4LwMWDs5nI8l1wv1poBT7li36e6i4)
- Driver Board for 40-pin TFT Touch (https://www.electromaker.io/shop/product/driver-board-for-40-pin-tft-touch)
- MCP23017 - i2c 16 input/output port expander (https://www.electromaker.io/shop/product/mcp23017-i2c-16-inputoutput-port-expander)
- RP2040-Plus, MCU Board Based on Raspberry Pi MCU RP2040, Pre-Soldered Header (https://www.pishop.ca/product/rp2040-plus-mcu-board-based-on-raspberry-pi-mcu-rp2040-pre-soldered-header/)
Goal and Problem:
I am trying to set up the display attached to the Pico with only print statements and hoping that every time the loop is complete it will replace the old print statement with a new print statement on the screen detached from the computer. The main problem with this is that I can get the screen to turn on but can not seem to get any thing on it. Most sites and tutorials suggest to import busio but this is apparently not a supported module in the micropython world and so I was thinking to set up the driver based on the pins on the Pico individually but am not sure where to start. The farthest I can confidently say is I can import from machine the Pin, I2C modules to use.
For Reference:
Driver hookup | Pin on Pico |
---|---|
Vin | 3V3(out) |
GND | GND |
SCK | Pin 24 |
MISO | Pin 21 |
MOSI | Pin 25 |
CS | Pin 22 |
RST | Pin 20 |
I am still quite new to micro python and need some guidance, I appreciate any and all help on this project and if I have done something wrong so far please let me know as it could fix problems for the whole machine.
I have tried many of the online tutorials so far for the driver boards and believe I just have either not quite found the right one or there may be an equivalent module/library that I am just unaware of.
import busio
import board
from machine import Pin, I2C
All I need in the end is Text to show up in black and white and simply state results to a test, nothing fancy. I appreciate any help people can offer.
Update:
this is my new code written on Thonny using adafruit packages and writing in circuit python.
import time
import busio
import digitalio
import board
from adafruit_ra8875 import ra8875
from adafruit_ra8875.ra8875 import color565
BLACK = color565(0, 0, 0)
RED = color565(255, 0, 0)
BLUE = color565(0, 255, 0)
GREEN = color565(0, 0, 255)
YELLOW = color565(255, 255, 0)
CYAN = color565(0, 255, 255)
MAGENTA = color565(255, 0, 255)
WHITE = color565(255, 255, 255)
# Configuration for CS and RST pins:
cs_pin = digitalio.DigitalInOut(board.22)
rst_pin = digitalio.DigitalInOut(board.20)
sck_pin = GPIO(board.24)
miso_pin = GPIO(board.21)
mosi_pin = GPIO(board.25)
# Config for display baudrate (default max is 6mhz):
BAUDRATE = 6000000
# Setup SPI bus using hardware SPI:
spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
# Create and setup the RA8875 display:
display = ra8875.RA8875(spi, cs=cs_pin, rst=rst_pin,
baudrate=BAUDRATE)
display.init()
# SCK = Pin(24)
# MISO = Pin(21)
# MOSI = Pin(25)
# CS = Pin(22)
# RST = Pin(20)