2020-05-13 19:09:52 -04:00

40 lines
1.0 KiB
Python

"""
Writes "Hello!" at different locations.
"""
import random
from machine import Pin, SPI
import st7789 as st7789
import time
import utime
# Choose a font
#from fonts import vga1_8x8 as font
#from fonts import vga2_8x8 as font
#from fonts import vga1_8x16 as font
from fonts import vga2_8x16 as font
#from fonts import vga1_16x16 as font
#from fonts import vga1_bold_16x16 as font
#from fonts import vga2_16x16 as font
#from fonts import vga2_bold_16x16 as font
def main():
tft = st7789.ST7789(
SPI(2, baudrate=30000000, polarity=1, phase=1, sck=Pin(18), mosi=Pin(19)),
135,
240,
reset=Pin(23, Pin.OUT),
cs=Pin(5, Pin.OUT),
dc=Pin(16, Pin.OUT),
backlight=Pin(4, Pin.OUT),
rotation=3
)
tft.init()
tft.fill(st7789.BLACK)
tft.text(font, "MicroPython", 0, 0, st7789.WHITE)
tft.text(font, "MicroPython", 0, 32, st7789.RED)
tft.text(font, "MicroPython", 0, 64, st7789.GREEN)
tft.text(font, "MicroPython", 0, 96, st7789.BLUE)
main()