from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit
setScreenColor(0xffffff)
env2_0 = unit.get(unit.ENV2, unit.PAHUB0)
pahub_1 = unit.get(unit.PAHUB, unit.PORTA)
tof_1 = unit.get(unit.TOF, unit.PAHUB1)
rfid_1 = unit.get(unit.RFID, unit.PAHUB5)
light_1 = unit.get(unit.LIGHT, unit.PORTB)
people = None
label1 = M5TextBox(120, 210, "0", lcd.FONT_UNICODE, 0xab00ff, rotate=0)
label2 = M5TextBox(0, 77, "Text", lcd.FONT_UNICODE, 0x000000, rotate=0)
label3 = M5TextBox(0, 29, "Text", lcd.FONT_UNICODE, 0x000000, rotate=0)
image0 = M5Img(170, 0, "res/chart.png", True)
label4 = M5TextBox(0, 167, "Temparature:", lcd.FONT_UNICODE, 0xff0000, rotate=0)
label5 = M5TextBox(0, 210, "Capacity:", lcd.FONT_UNICODE, 0x00fff4, rotate=0)
label6 = M5TextBox(249, 167, "℃", lcd.FONT_UNICODE, 0xff0000, rotate=0)
label0 = M5TextBox(170, 167, "0", lcd.FONT_UNICODE, 0x49ff00, rotate=0)
from numbers import Number
people = 0
image0.show()
while True:
if rfid_1.isCardOn():
if (rfid_1.readUid()) == 'c255fc117a':
label2.setText('Vaccinated')
label3.setText(str(rfid_1.readUid()))
speaker.tone(1800, 200)
rgb.setColorAll(0x33ff33)
wait(1)
else:
label2.setText('Scan card')
label3.setText('Card ID')
wait(1)
if (env2_0.temperature) <= 37:
label0.setText(str(env2_0.temperature))
rgb.setColorAll(0x33ff33)
wait(1)
else:
speaker.tone(1800, 200)
rgb.setColorAll(0xff0000)
wait(1)
if (tof_1.distance) < 400:
people = (people if isinstance(people, Number) else 0) + 1
label1.setText(str(people))
rgb.setColorAll(0x33ff33)
speaker.tone(1800, 200)
wait(1)
if people >= 300:
rgb.setColorAll(0xff0000)
speaker.tone(1800, 200)
wait(1)
if (light_1.analogValue) < 300:
speaker.tone(1800, 200)
lcd.setBrightness(0)
rgb.setColorAll(0x000000)
wait(1)
wait_ms(2)
Comments