# https://www.az-delivery.de/blogs/azdelivery-blog-fur-arduino-und-raspberry-pi/peltierelemente-und-micropython-teil-5-touchdisplay-wir-sprechen-mit-unserem-kuhlschank

#--------------------------------------------------
# Module importieren
import machine
import time
import ili9341
import tt14
import tt24

#--------------------------------------------------
# setup
spi = machine.SPI(2, baudrate=40000000, sck=machine.Pin(18), mosi=machine.Pin(23), miso=machine.Pin(19))
tft = ili9341.ILI9341(
    spi,
    cs=machine.Pin(15, machine.Pin.OUT),
    dc=machine.Pin(4, machine.Pin.OUT),
    rst=machine.Pin(2, machine.Pin.OUT),
    w=320, h=240,
    r=0
    )

# Font auswählen
#tft.set_font(tt14)
tft.set_font(tt24)

# Farben für FG und BG
tft.set_color(ili9341.color565(255, 0, 0), ili9341.color565(0, 0, 0))

#--------------------------------------------------
# loop
while True:
    # Text an Koordinate (x/y=30/90) ausgeben
    tft.set_pos(30, 90)
    tft.write("TFT-Display")
    time.sleep(1)

    # Display löschen
    tft.erase()
    time.sleep(1)