Compare commits

..
2 Commits
Author SHA1 Message Date
C F 150708564c main 2025-12-17 15:09:01 -08:00
C F f4656235a3 Initial commit 2025-12-17 15:08:53 -08:00
2 changed files with 75 additions and 0 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
# studspider-client-m5stack-uiflow2
+74
View File
@@ -0,0 +1,74 @@
import os, sys, io
import M5
from M5 import *
import requests2
import network
import time
image1 = None
status = None
http_req = None
wlan = None
# Describe this function...
def update():
global image1, status, http_req, wlan
http_req = requests2.post('https://traps.moe:7432', json={'COMMAND':'changeme'}, headers={'Content-Type': 'application/json','idempotency-key':'changeme'})
def setup():
global image1, status, http_req, wlan
M5.begin()
Widgets.setRotation(0)
Widgets.fillScreen(0x000000)
image1 = Widgets.Image("/flash/res/img/hourglass.png", 1, 26, scale_x=0.5, scale_y=0.5)
status = Widgets.Label("READY", 25, 107, 1.0, 0xffffff, 0x000000, Widgets.FONTS.DejaVu24)
Speaker.setVolumePercentage(0.5)
image1.setVisible(False)
Speaker.begin()
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('Play-Well Staff', 'Jigabits2024')
Widgets.fillScreen(0x33ffff)
status.setColor(0x000000, 0x33ffff)
status.setText(str('WIFI OK'))
time.sleep(3)
time.timezone('GMT-8')
Speaker.tone(6000, 100)
Speaker.tone(5000, 100)
Widgets.fillScreen(0x33ff33)
status.setColor(0x000000, 0x33ff33)
status.setText(str('READY'))
def loop():
global image1, status, http_req, wlan
M5.update()
if BtnA.isPressed():
Speaker.tone(8000, 50)
Widgets.fillScreen(0xff0000)
image1.setVisible(True)
time.sleep(15)
Speaker.tone(2000, 50)
Speaker.tone(3000, 100)
image1.setVisible(False)
Widgets.fillScreen(0x33ff33)
status.setVisible(True)
if __name__ == '__main__':
try:
setup()
while True:
loop()
except (Exception, KeyboardInterrupt) as e:
try:
from utility import print_error_msg
print_error_msg(e)
except ImportError:
print("please update to latest firmware")