from machine import Pin, SPI
import time
import ili9341
import glcdfont
spi = SPI(2, baudrate=40000000,
sck=Pin(18), mosi=Pin(23), miso=Pin(19))
display = ili9341.ILI9341(
spi,
cs=Pin(15),
dc=Pin(2),
rst=Pin(4),
width=240,
height=320
)
display.fill(0)
display.text(glcdfont, "SMART STUDY DESK", 20, 20, 0xFFFF)
display.text(glcdfont, "Task 1 [ ]", 20, 60, 0xFFFF)
ok_btn = Pin(32, Pin.IN, Pin.PULL_UP)
cancel_btn = Pin(33, Pin.IN, Pin.PULL_UP)
task_done = False
while True:
if not ok_btn.value():
task_done = True
display.fill(0)
display.text(glcdfont, "Task 1 [✓]", 20, 60, 0x07E0)
time.sleep(0.3)
if not cancel_btn.value():
task_done = False
display.fill(0)
display.text(glcdfont, "Task 1 [✗]", 20, 60, 0xF800)
time.sleep(0.3)