from machine import Pin, SPI
import time
import st7789py as st7789
from st7789py import color565
time.sleep_ms(1000) # Wait for USB to become ready
print("Hello, Pi Pico!")
print(hex(color565(0,0x16,0xff)))
TFA = 40 # top free area when scrolling
BFA = 40 # bottom free area when scrolling
def config(rotation=0):
Pin(22, Pin.OUT, value=1)
spi = SPI(0,
baudrate=62500000,
polarity=0,
phase=0,
sck=Pin(2, Pin.OUT),
mosi=Pin(3, Pin.OUT),
miso=None)
return st7789.ST7789(
spi,
240,
240,
cs=Pin(5, Pin.OUT),
dc=Pin(1, Pin.OUT),
reset=Pin(6, Pin.OUT),
backlight=Pin(4, Pin.OUT),
rotation=rotation
)
tft = config()
for i in range(10,120):
#tft.pixel(i,i,st7789.RED)
tft.fill(st7789.GREEN)
time.sleep_ms(10)