Mercurial > code > home > repos > 7key
comparison main.py @ 1:5a93179ccae9
7key code
author | drewp@bigasterisk.com |
---|---|
date | Thu, 11 May 2023 15:07:10 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:b0c0a808af2b | 1:5a93179ccae9 |
---|---|
1 ''' | |
2 see https://github.com/ustropo/Python_ILI9486/blob/master/Python_ILI9486/ILI9486.py | |
3 | |
4 keyboard: | |
5 key esp | |
6 --------- | |
7 1 35 & pullup | |
8 b 22 | |
9 3 34 & pullup | |
10 a 23 | |
11 0 39 & pullup | |
12 2 36 & pullup | |
13 | |
14 ST7785: | |
15 esp lcd | |
16 ----------- | |
17 3.3 vcc | |
18 gnd gnd | |
19 21 cs | |
20 3.3 reset | |
21 19 a0 | |
22 18 sda | |
23 5 sdk | |
24 17/tx2 led | |
25 | |
26 ====================================================== | |
27 | |
28 prev lcd: | |
29 esp - LCD | |
30 32 blk lcd_d1 | |
31 33 brn lcd_d0 | |
32 25 red lcd_d7 | |
33 26 orn lcd_d6 | |
34 27 yel lcd_d5 | |
35 14 grn lcd_d4 | |
36 12 blu lcd_d3 | |
37 13 vio lcd_d2 | |
38 | |
39 NC reset | |
40 NC 3.3v | |
41 5v/VIN 5v | |
42 gnd gnd | |
43 18 lcd_rd | |
44 5 lcd_wr | |
45 17/TX2 lcd_rs/dc | |
46 16/RX2 lcd_cs | |
47 3.3v lcd_rst | |
48 NC f_cs | |
49 ''' | |
50 import time | |
51 | |
52 import esp | |
53 from machine import Pin | |
54 | |
55 from net import Net | |
56 from keys import Keys | |
57 from display import Display | |
58 | |
59 # esp.osdebug(None) | |
60 # import gc | |
61 # gc.collect() | |
62 | |
63 display = Display() | |
64 display.startupText(0, "Startup:") | |
65 display.backlight(100) | |
66 | |
67 net = Net() | |
68 net.connect_wifi(display.startupText) | |
69 net.connect_mqtt(display.startupText) | |
70 display.backlight(50) | |
71 keys = Keys() | |
72 | |
73 while True: | |
74 net.mqtt_poll() | |
75 r = keys.newKeysDown() | |
76 if r is not None: | |
77 net.send('7key/sensor', r) | |
78 last_message = time.time() | |
79 | |
80 print("go2") | |
81 blue_led = Pin(2, Pin.OUT) | |
82 print(res) | |
83 blue_led(1) | |
84 time.sleep(.05) | |
85 blue_led(0) |