view main.py @ 2:3fe178258a80 default tip

sysfont
author drewp@bigasterisk.com
date Thu, 11 May 2023 15:07:22 -0700
parents 5a93179ccae9
children
line wrap: on
line source

'''
see https://github.com/ustropo/Python_ILI9486/blob/master/Python_ILI9486/ILI9486.py

keyboard:
key   esp
---------
1     35 & pullup
b     22
3     34 & pullup
a     23
0     39 & pullup
2     36 & pullup

ST7785:
esp     lcd
-----------
3.3     vcc
gnd     gnd
21      cs
3.3     reset
19      a0
18      sda
5       sdk
17/tx2  led

======================================================

prev lcd:
esp   -   LCD
32   blk  lcd_d1
33   brn  lcd_d0
25   red  lcd_d7
26   orn  lcd_d6
27   yel  lcd_d5
14   grn  lcd_d4
12   blu  lcd_d3
13   vio  lcd_d2

NC        reset
NC        3.3v
5v/VIN    5v
gnd       gnd
18        lcd_rd
5         lcd_wr
17/TX2    lcd_rs/dc
16/RX2    lcd_cs
3.3v      lcd_rst
NC        f_cs
'''
import time

import esp
from machine import Pin

from net import Net
from keys import Keys
from display import Display

# esp.osdebug(None)
# import gc
# gc.collect()

display = Display()
display.startupText(0, "Startup:")
display.backlight(100)

net = Net()
net.connect_wifi(display.startupText)
net.connect_mqtt(display.startupText)
display.backlight(50)
keys = Keys()

while True:
    net.mqtt_poll()
    r = keys.newKeysDown()
    if r is not None:
        net.send('7key/sensor', r)
        last_message = time.time()

print("go2")
blue_led = Pin(2, Pin.OUT)
print(res)
blue_led(1)
time.sleep(.05)
blue_led(0)