Skip to content

Commit c1d352e

Browse files
committed
M5: snailing through the UI flow setup
1 parent d410aa1 commit c1d352e

File tree

5 files changed

+95
-1
lines changed

5 files changed

+95
-1
lines changed

m5-stack/Rev.0/TODO.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,18 @@
1515
- [x] bootsel
1616

1717
## [ ] Enclosure
18-
- https://github.com/uetchy/m5stack-module
18+
- https://github.com/uetchy/m5stack-module
19+
20+
```
21+
from machine import Pin
22+
from utility import print_error_msg
23+
import time
24+
25+
# Setup GPIO6 as output
26+
led = Pin(2, Pin.OUT)
27+
28+
while True:
29+
print("asdfasd", led.value())
30+
led.value(not led.value()) # Toggle pin state
31+
time.sleep(2) # Wait 10 seconds
32+
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
.venv
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
PORT = /dev/tty.usbmodem142201
2+
# PORT = /dev/cu.usbmodem142201
3+
4+
flash:
5+
esptool --chip esp32s3 --port $(PORT) erase-flash
6+
esptool --chip esp32s3 --port $(PORT) write_flash -z 0x0000 ~/Development/tools/m5/uiflow-e986468-esp32s3-spiram-16mb-cores3-v2.2.8-20250606.bin
7+
8+
run:
9+
ampy --port $(PORT) put main.py
10+
11+
tty:
12+
minicom -b 115200 -o -D $(PORT)
13+
14+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import os, sys, io
2+
import M5
3+
import time
4+
5+
from M5 import *
6+
from utility import print_error_msg
7+
8+
def setup():
9+
Widgets.setBrightness(128)
10+
Widgets.fillScreen(0x00c400)
11+
12+
def loop():
13+
print("woot")
14+
time.sleep(5)
15+
M5.update()
16+
17+
if __name__ == '__main__':
18+
try:
19+
setup()
20+
while True:
21+
loop()
22+
except (Exception, KeyboardInterrupt) as e:
23+
try:
24+
print_error_msg(e)
25+
except ImportError:
26+
print("please update to latest firmware")

m5-stack/Rev.0/micropython/main.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import os, sys, io
2+
import M5
3+
import time
4+
5+
from M5 import *
6+
from utility import print_error_msg
7+
8+
B10058400 = None
9+
T10058400 = None
10+
11+
def setup():
12+
global B10058400, T10058400
13+
14+
M5.begin()
15+
Widgets.setRotation(1)
16+
Widgets.fillScreen(0x222222)
17+
B10058400 = Widgets.Rectangle(32, 32, 256, 32, 0xfc0000, 0xeacdcd)
18+
T10058400 = Widgets.Label("10058400", 112, 38, 1.0, 0x222222, 0xeacdcd, Widgets.FONTS.DejaVu18)
19+
20+
# page0.screen_load()
21+
22+
def loop():
23+
global B10058400, T10058400
24+
M5.update()
25+
(w, x, y, z) = M5.Touch.getTouchPointRaw()
26+
print(f'w:{w} x:{x} y:{y} z:{z}')
27+
time.sleep(1)
28+
29+
if __name__ == '__main__':
30+
try:
31+
setup()
32+
while True:
33+
loop()
34+
except (Exception, KeyboardInterrupt) as e:
35+
try:
36+
print_error_msg(e)
37+
except ImportError:
38+
print("please update to latest firmware")

0 commit comments

Comments
 (0)