作品背景:
2020年一开年,新冠病毒疫情肆虐全球,各国人民都生活在恐惧不安中,确诊病例数字也在天天变化,如今各大中小学都开学了,可是防疫工作成为重中之重。于是我们为中小学生设计这款智慧校园防疫系统。
功能设计
1、下位机使用是掌控板(EPS32)它主要用来连接网络并 显示时间、天气、今日疫情要闻、疫情数据实时查询、口罩识别测温等功能。
2、上位机使用的是Maix bit,使用maixhub训练的口罩识别模型(具体的口罩识别教程:可以参考我之前的文章:【MaixPy 教程】用mixly玩转口罩识别),进而来检测学生是否佩戴口罩!
3、非接触红外测温传感器(mlx90614),用于测量学生的体温。4、人体红外热释电运动传感器,它用来检测是否有人通过,如果学生体温正常并且佩戴口罩,校区门杆就会由舵机控制打开。
4、Maix bit 与掌控板通过软串口进行通讯。
硬件清单
序列 |
硬件名称 |
数量 |
1 |
掌控板 |
1 |
2 |
掌控宝 |
1 |
3 |
Maix bit |
1 |
4 |
mlx90614 |
1 |
5 |
人体红外热释电运动传感器 |
1 |
6 |
9G舵机 |
1 |
7 |
激光切割沙盘模型 |
1 |
电路连接
制作步骤
1、用laserbox画出该智慧校园防疫系统沙盘的主体结构:
2、对设计好的模型进行激光切割
3、小组组内开始进行组装
4、组装完成
上位机程序
code:
import sensor
import machine
import lcd
import KPU as kpu
from machine import UART
from fpioa_manager import fm
from Maix import GPIO
import mlx90614
from machine import I2C
import time
i2c = I2C(I2C.I2C0, freq=100000, scl=28, sda=29)
ir = mlx90614.MLX90614(i2c)
def mask():
temp = ir.getObjCelsius()
print(temp)
plist = kpu.forward(KPU,img)[:]
pmasx = max(plist)
max_index = plist.index(pmasx)
print("置信度" + str(pmasx) + "识别类型" + str(calss[max_index]))
mylist = [pmasx, calss[max_index],temp]
uart1.write(str(mylist))
lcd.display(img)
lcd.init(freq=15000000,color=0x0000)
lcd.rotation(3)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)
sensor.skip_frames(10)
sensor.set_hmirror(1)
sensor.set_vflip(1)
sensor.set_windowing((224,224))
fm.register(10,fm.fpioa.UART1_TX)
fm.register(9,fm.fpioa.UART1_RX)
uart1=UART(UART.UART1, 115200,8,0,0, timeout=1000, read_buf_len=4096)
anchor= (1.889, 2.5245, 2.9465, 3.94056, 3.99987, 5.3658, 5.155437, 6.92275, 6.718375, 9.01025)
calss= ['mask','unmask']
KPU = kpu.load(0x300000)
kpu.init_yolo2(KPU,0.5,0.3,5,anchor)
while True:
img = sensor.snapshot()
try:
if uart1.any():
msg = uart1.read().decode("utf-8")
print(msg)
if msg == "person":
mask()
lcd.display(img)
except:
lcd.display(img)
下位机程序
code:
from mpython import *
import framebuf
import font.digiface_16
import time
import font.digiface_30
p16 = MPythonPin(16, PinMode.OUT)
def home():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
oled.fill(0)
display_font(font.digiface_16, (''.join([str(x) for x in [time.localtime()[0], '-', time.localtime()[1], '-', time.localtime()[2]]])), 0, 0, False, 2)
display_font(font.digiface_16, (''.join([str(x) for x in [time.localtime()[3], ':', time.localtime()[4], ':', time.localtime()[5]]])), 70, 0, False, 2)
oled.Bitmap(0, 18, bytearray([0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x06,0x76,0x00,0x03,0x62,0x00,0x03,0xef,0x80,0x01,0xdd,0x80,0x03,0x86,0x00,0x3e,0xff,0x80,0x1c,0xf6,0x00,0x02,0xff,0xc0,0x02,0xfe,0x00,0x04,0xef,0xe0,0x1c,0xff,0xf0,0x18,0xe0,0x00,0x00,0xe0,0x00,0x00,0xe0,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x70,0x00,0x00,0x7e,0x00,0x03,0xe6,0x00,0x02,0xe0,0x00,0x00,0xff,0x80,0x03,0xfd,0xc0,0x07,0x9c,0xc0,0x1b,0xfc,0xc0,0x1b,0xed,0xc0,0x1b,0xfd,0xc0,0x1a,0x63,0xc0,0x00,0xe3,0x80,0x00,0x61,0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]), 20, 45, 1)
display_font(font.digiface_30, (str(w3["results"][0]["now"]["temperature"])), 80, 25, False, 2)
WeatherIcon('多云')
oled.show()
if light.read() < 2000:
p16.write_digital(1)
else:
p16.write_digital(0)
def Loading():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
for i in range(1, 111, 10):
oled.fill(0)
oled.DispChar(str('加载中......'), 40, 12, 1)
myUI.ProgressBar(30, 35, 70, 8, i)
oled.show()
time.sleep(0.5)
oled.fill(0)
oled.Bitmap(0, 0, bytearray([0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xf0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xf0,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xf0,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xf0,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xf0,0xff,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf7,0xf0,0xfe,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xf3,0xf0,0xfc,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0xf9,0xff,0xf9,0xfc,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0xfc,0x7f,0xf3,0xe3,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xcf,0x8f,0x8f,0x7f,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xf9,0xf0,0x79,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0x3f,0xcf,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xe4,0x7f,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xfb,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xff,0xfb,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0xff,0xfb,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0xbf,0xfb,0xff,0xe7,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x87,0xfb,0xff,0x87,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x84,0x7b,0xf8,0x87,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x84,0x1b,0xe0,0x87,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x84,0x1b,0xe0,0x87,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xe4,0x1b,0xe0,0x87,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xfe,0x1b,0xe0,0x87,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xdb,0xe0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xfb,0xe0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xfb,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xfb,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3b,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x38,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x1c,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,0xbc,0x00,0x00,0x00,0x01,0xe0,0x80,0x00,0x78,0x00,0x00,0x00,0x00,0x1e,0x00,0x00,0xf8,0x00,0x04,0x00,0x01,0xb0,0x80,0x00,0xf8,0x00,0x00,0x00,0x00,0xf0,0x00,0x10,0x3c,0x00,0x06,0x00,0x01,0x31,0x80,0x01,0xd8,0x00,0x00,0x00,0x07,0x04,0x00,0x11,0xf8,0x00,0x02,0x00,0x03,0x33,0xa0,0x01,0xfc,0x00,0x00,0x00,0x01,0x74,0x00,0x10,0x7e,0x00,0x03,0x08,0x03,0xff,0x30,0x00,0xfc,0x00,0x00,0x00,0x03,0x66,0x01,0x99,0xf0,0x00,0x03,0x0c,0x07,0x73,0x30,0x00,0xde,0x00,0x00,0x00,0x0b,0x66,0x01,0xbf,0xa0,0x04,0x03,0x0c,0x07,0xe6,0x70,0x03,0x1e,0x00,0x00,0x00,0x1f,0x3c,0x01,0xf0,0x3c,0x06,0x27,0x04,0x06,0xe6,0xe0,0x07,0xf8,0x00,0x00,0x00,0x36,0xec,0x01,0xe0,0x6c,0x02,0x3f,0x00,0x07,0xed,0xc0,0x07,0x98,0x00,0x00,0x00,0x2e,0x18,0x00,0x20,0xcc,0x00,0x0f,0x00,0x07,0x28,0xc0,0x00,0x18,0x00,0x00,0x00,0x0c,0x3c,0x00,0x60,0xfc,0x00,0x06,0x00,0x00,0x18,0x80,0x00,0x18,0x00,0x00,0x00,0x3c,0xf3,0x80,0x61,0xc4,0x00,0x06,0x00,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x00,0x1d,0xc1,0xf0,0x61,0x94,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x30,0x20,0xcc,0x00,0x00,0x00,0x00,0x60,0x00,0x07,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x01,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]), 128, 64, 1)
oled.show()
time.sleep(2)
def WeatherIcon(x):
global i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
if x == '多云':
oled.Bitmap(25, 18, bytearray([0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x1c,0x30,0xc0,0x00,0x00,0x00,0x1c,0x01,0xc0,0x00,0x00,0x00,0x00,0xfc,0x80,0x00,0x00,0x00,0x03,0xff,0x00,0x00,0x00,0x01,0x8f,0xff,0x8c,0x00,0x00,0x01,0x9f,0x03,0xce,0x00,0x00,0x01,0x9c,0x01,0xee,0x00,0x00,0x00,0x38,0x00,0xe0,0x00,0x00,0x00,0x38,0x00,0x60,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0xff,0x00,0x00,0x07,0x70,0x03,0xff,0xc0,0x00,0x07,0x70,0x0f,0x81,0xf0,0x00,0x00,0x70,0x1e,0x00,0x78,0x00,0x00,0x20,0x1c,0x00,0x3c,0x00,0x00,0x1f,0xb8,0x00,0x1c,0x00,0x00,0x3f,0xf8,0x00,0x0e,0x00,0x00,0xff,0xf0,0x00,0x0e,0x00,0x00,0xe0,0x60,0x00,0x07,0x00,0x01,0xc0,0x00,0x00,0x07,0x00,0x03,0x80,0x00,0x00,0x07,0x00,0x03,0x00,0x00,0x00,0x07,0x00,0x03,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x06,0x00,0x03,0x00,0x00,0x00,0x0e,0x00,0x03,0x80,0x00,0x00,0x1c,0x00,0x03,0x80,0x00,0x00,0x1c,0x00,0x01,0xc0,0x00,0x00,0x78,0x00,0x00,0xe0,0x00,0x00,0xf0,0x00,0x00,0x7f,0xff,0xff,0xe0,0x00,0x00,0x3f,0xff,0xff,0x80,0x00,0x00,0x0f,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]), 45, 45, 1)
elif x == '雷阵雨':
oled.Bitmap(25, 18, bytearray([0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xe0,0x00,0x00,0x00,0x00,0x3f,0xf8,0x00,0x00,0x00,0x00,0xff,0xfe,0x00,0x00,0x00,0x01,0xfc,0x7f,0x00,0x00,0x00,0x03,0xe0,0x0f,0x80,0x00,0x00,0xff,0x80,0x03,0xc0,0x00,0x03,0xff,0x80,0x01,0xe0,0x00,0x07,0xff,0x00,0x01,0xe0,0x00,0x0f,0xc0,0x00,0x00,0xe0,0x00,0x1f,0x00,0x00,0x00,0xf0,0x00,0x1e,0x00,0x00,0x00,0x7c,0x00,0x3c,0x00,0x00,0x00,0x7f,0x00,0x3c,0x00,0x00,0x00,0x7f,0x80,0x38,0x00,0x00,0x00,0x07,0xc0,0x38,0x00,0x00,0x00,0x01,0xe0,0x38,0x00,0x07,0xf8,0x01,0xe0,0x38,0x00,0x0f,0xfc,0x00,0xe0,0x3c,0x00,0x1f,0xf8,0x00,0xe0,0x3c,0x00,0x1f,0xf8,0x00,0xe0,0x1e,0x00,0x3f,0xf0,0x01,0xe0,0x1f,0x00,0x3f,0xfe,0x01,0xc0,0x0f,0xc0,0x7f,0xff,0x07,0xc0,0x07,0xc0,0x7f,0xfe,0x7f,0x80,0x03,0xc0,0xff,0xfc,0x7f,0x00,0x00,0x40,0xff,0xf8,0x7c,0x00,0x00,0x00,0xff,0xf0,0x00,0x00,0x00,0x00,0x1f,0xe0,0x00,0x00,0x00,0x00,0x1f,0xc0,0x00,0x00,0x00,0x00,0x3f,0x80,0x00,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x01,0xc0,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]), 45, 45, 1)
elif x == '晴天':
oled.Bitmap(25, 18, bytearray([0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x20,0x07,0x80,0x08,0x00,0x00,0x70,0x07,0x80,0x3c,0x00,0x00,0xf8,0x03,0x00,0x7c,0x00,0x00,0x7c,0x00,0x00,0xfc,0x00,0x00,0x7e,0x07,0xc0,0xf8,0x00,0x00,0x1e,0x3f,0xf0,0xf0,0x00,0x00,0x0c,0x7f,0xfc,0xe0,0x00,0x00,0x01,0xff,0xfe,0x00,0x00,0x00,0x01,0xff,0xff,0x00,0x00,0x00,0x03,0xff,0xff,0x80,0x00,0x00,0x07,0xff,0xff,0x80,0x00,0x00,0x07,0xff,0xff,0xc0,0x00,0x00,0x07,0xff,0xff,0xc0,0x00,0x0f,0x8f,0xff,0xff,0xc7,0xc0,0x1f,0xcf,0xff,0xff,0xef,0xe0,0x1f,0xef,0xff,0xff,0xef,0xf0,0x1f,0xcf,0xff,0xff,0xef,0xe0,0x0f,0x8f,0xff,0xff,0xc3,0xc0,0x00,0x07,0xff,0xff,0xc0,0x00,0x00,0x07,0xff,0xff,0xc0,0x00,0x00,0x07,0xff,0xff,0x80,0x00,0x00,0x03,0xff,0xff,0x80,0x00,0x00,0x01,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xfe,0x00,0x00,0x00,0x1c,0x7f,0xfc,0xe0,0x00,0x00,0x3e,0x3f,0xf0,0xf0,0x00,0x00,0x7e,0x07,0xc0,0xf8,0x00,0x00,0x7c,0x00,0x00,0x7c,0x00,0x00,0xf8,0x03,0x00,0x3c,0x00,0x00,0x70,0x07,0x80,0x1c,0x00,0x00,0x20,0x07,0x80,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]), 45, 45, 1)
else:
oled.Bitmap(25, 18, bytearray([0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x80,0x00,0x00,0x00,0x00,0xff,0xf0,0x00,0x00,0x00,0x01,0xff,0xf8,0x00,0x00,0x00,0x07,0xff,0xfe,0x00,0x00,0x00,0x0f,0xc0,0x3f,0x00,0x00,0x00,0x1f,0x00,0x0f,0x80,0x00,0x00,0x1e,0x00,0x07,0x80,0x00,0x00,0x3c,0x00,0x03,0xf0,0x00,0x00,0xf8,0x00,0x01,0xfc,0x00,0x01,0xf8,0x00,0x01,0xff,0x00,0x07,0xf8,0x00,0x00,0x1f,0x80,0x0f,0xc0,0x00,0x00,0x07,0xc0,0x0f,0x00,0x00,0x00,0x03,0xc0,0x1e,0x00,0x00,0x00,0x01,0xe0,0x1c,0x00,0x00,0x00,0x01,0xe0,0x3c,0x00,0x00,0x00,0x00,0xe0,0x3c,0x00,0x00,0x00,0x00,0xe0,0x3c,0x00,0x00,0x00,0x00,0xe0,0x3c,0x00,0x00,0x00,0x00,0xe0,0x3c,0x00,0x00,0x00,0x00,0xe0,0x1c,0x00,0x00,0x00,0x01,0xe0,0x1e,0x00,0x00,0x00,0x01,0xc0,0x0f,0x00,0x00,0x00,0x03,0xc0,0x0f,0x80,0x00,0x00,0x0f,0x80,0x07,0xff,0xff,0xff,0xff,0x00,0x03,0xff,0xff,0xff,0xfe,0x00,0x00,0xff,0xff,0xff,0xf8,0x00,0x00,0x1d,0xff,0xff,0xc0,0x00,0x00,0x01,0xf8,0x3f,0x00,0x00,0x00,0x01,0xf0,0x1e,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x30,0x00,0x00,0x00,0x03,0x00,0x30,0x00,0x00,0x00,0x07,0x80,0x78,0x00,0x00,0x00,0x0f,0xc0,0xfc,0x00,0x00,0x00,0x0f,0xc0,0xfc,0x00,0x00,0x00,0x0f,0xc0,0xfc,0x00,0x00,0x00,0x0f,0xc0,0xfc,0x00,0x00,0x00,0x07,0x80,0x78,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ]), 45, 45, 1)
import font.digiface_11
def LifeIndex():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
oled.fill(0)
oled.hline(0, 0, 128, 1)
oled.hline(0, 31, 128, 1)
oled.hline(0, 63, 128, 1)
oled.vline(0, 0, 64, 1)
oled.vline(64, 0, 64, 1)
oled.vline(127, 0, 64, 1)
oled.DispChar(str('紫外线指数'), 1, 1, 1)
display_font(font.digiface_11, (str(w2["results"][0]["suggestion"]["uv"]["brief"])), 20, 20, False, 2)
oled.DispChar(str('穿衣指数'), 70, 1, 1)
display_font(font.digiface_11, (str(w2["results"][0]["suggestion"]["dressing"]["brief"])), 80, 20, False, 2)
oled.DispChar(str('感冒指数'), 1, 33, 1)
display_font(font.digiface_11, (str(w2["results"][0]["suggestion"]["flu"]["brief"])), 20, 50, False, 2)
oled.DispChar(str('运动指数'), 70, 33, 1)
display_font(font.digiface_11, (str(w2["results"][0]["suggestion"]["sport"]["brief"])), 80, 50, False, 2)
oled.show()
import network
my_wifi = wifi()
my_wifi.connectWiFi('Erised', 'yiruosi88')
import ntptime
import json
import urequests
from servo import Servo
from machine import UART
uart1 = machine.UART(1, baudrate=115200, tx=Pin.P1, rx=Pin.P0)
def WeatherForecast():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
oled.fill(0)
oled.hline(0, 0, 128, 1)
oled.hline(0, 18, 128, 1)
oled.hline(0, 63, 128, 1)
oled.vline(0, 0, 64, 1)
oled.vline(31, 0, 64, 1)
oled.vline(127, 0, 64, 1)
oled.DispChar(str('淮南'), 3, 1, 1)
oled.DispChar(str('今天'), 3, 19, 1)
oled.DispChar(str('明天'), 3, 32, 1)
oled.DispChar(str('后天'), 3, 47, 1)
oled.DispChar(str('最高'), 33, 1, 1)
oled.DispChar(str('最低'), 65, 1, 1)
oled.DispChar(str('气象'), 97, 1, 1)
oled.DispChar(str((str(w1["results"][0]["daily"][0]["high"]))), 36, 19, 1)
oled.DispChar(str((str(w1["results"][0]["daily"][1]["high"]))), 36, 32, 1)
oled.DispChar(str((str(w1["results"][0]["daily"][2]["high"]))), 36, 47, 1)
oled.DispChar(str((str(w1["results"][0]["daily"][0]["low"]))), 68, 19, 1)
oled.DispChar(str((str(w1["results"][0]["daily"][1]["low"]))), 68, 32, 1)
oled.DispChar(str((str(w1["results"][0]["daily"][2]["low"]))), 68, 47, 1)
oled.DispChar(str((str(w1["results"][0]["daily"][0]["text_day"]))), 97, 19, 1)
oled.DispChar(str((str(w1["results"][0]["daily"][1]["text_day"]))), 97, 32, 1)
oled.DispChar(str((str(w1["results"][0]["daily"][2]["text_day"]))), 97, 47, 1)
oled.show()
def EpidemicData():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
if state:
oled.fill(0)
oled.Bitmap(0, 0, bytearray([0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xf7,0xef,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xe3,0xc7,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xe7,0xe7,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xfc,0x3f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xfe,0x7f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xfe,0x7f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xfe,0x7f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xfe,0x7f,0xe8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xfe,0x7f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0xfe,0x7f,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0xfe,0x7f,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0xfe,0x7f,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0xfe,0x7f,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x01,0x00,0x00,0x02,0x18,0x01,0x80,0x01,0x00,0x10,0x00,0x40,0x00,0x00,0x01,0x80,0x01,0x00,0x00,0x03,0x1c,0x00,0xc0,0x01,0x00,0x18,0x00,0x40,0x00,0x00,0x00,0xc0,0x07,0x80,0xc0,0x07,0xb0,0x09,0xe0,0x01,0x00,0x78,0x08,0x80,0x00,0x00,0x0f,0x00,0x23,0x81,0x40,0x0e,0x30,0x1e,0x80,0x81,0xc0,0x30,0x0e,0xe8,0x00,0x00,0x05,0x40,0x27,0x40,0xc8,0x03,0x2c,0x38,0x80,0xe3,0x00,0x7f,0x16,0x08,0x00,0x00,0x05,0x40,0xa7,0x01,0x8e,0x02,0x58,0x37,0x81,0xad,0x00,0xf0,0x1c,0x48,0x00,0x00,0x15,0x60,0xbe,0x01,0xe4,0x06,0x70,0x05,0x81,0xa1,0x03,0x10,0x04,0xe8,0x00,0x00,0x1c,0xc0,0xe3,0x82,0xc4,0x0e,0x9c,0x01,0x81,0xef,0x06,0x38,0x04,0xe8,0x00,0x00,0x2d,0x40,0xc2,0x80,0xcc,0x0e,0xbc,0x03,0xc0,0xa1,0x0c,0x68,0x0c,0xe8,0x00,0x00,0x28,0xc0,0x47,0x80,0xce,0x06,0xbc,0x0f,0x00,0x01,0x00,0x78,0x04,0x08,0x00,0x00,0x19,0xe0,0x46,0x81,0xd1,0x81,0x00,0x06,0x40,0x01,0x00,0x58,0x00,0x18,0x00,0x00,0x1b,0x1c,0x45,0x80,0xc0,0x03,0x00,0x0c,0x20,0x03,0x00,0x9c,0x00,0x58,0x00,0x00,0x00,0x00,0x20,0x80,0x00,0x03,0x00,0x0c,0x20,0x01,0x00,0x78,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]), 128, 64, 1)
oled.show()
if button_a.value() == 0:
state = False
c_dict = {}
c_list = []
_response = urequests.get('https://gitee.com/hockel/COVID/raw/master/json/COVID.json', headers={"Content-Type":"application/json"}, data=json.dumps({"item":'data'}))
c_list = _response.json().get('newslist')
if num < len(c_list):
c_dict = c_list[num]
num = num + 1
oled.fill(0)
oled.DispChar(str((str(c_dict.get('provinceName')))), 0, 0, 1)
oled.DispChar(str(('总确诊人数:' + str(c_dict.get('confirmedCount')))), 0, 16, 1)
oled.DispChar(str((''.join([str(x) for x in ['当前确诊:', c_dict.get('currentConfirmedCount'), ' 疑似:', c_dict.get('suspectedCount')]]))), 0, 32, 1)
oled.DispChar(str((''.join([str(x) for x in ['治愈:', c_dict.get('curedCount'), ' 死亡:', c_dict.get('deadCount')]]))), 0, 48, 1)
oled.show()
else:
num = 0
elif button_b.value() == 0:
state = False
c_list = []
c_dict = {}
_response = urequests.get('https://gitee.com/hockel/COVID/raw/master/json/COVID.json', headers={"Content-Type":"application/json"}, data=json.dumps({"item":'data'}))
c_list = _response.json().get('newslist')
num = num + -1
if 0 < num:
c_dict = c_list[num]
oled.fill(0)
oled.DispChar(str((str(c_dict.get('provinceName')))), 0, 0, 1)
oled.DispChar(str(('总确诊人数:' + str(c_dict.get('confirmedCount')))), 0, 16, 1)
oled.DispChar(str((''.join([str(x) for x in ['当前确诊:', c_dict.get('currentConfirmedCount'), ' 疑似:', c_dict.get('suspectedCount')]]))), 0, 32, 1)
oled.DispChar(str((''.join([str(x) for x in ['治愈:', c_dict.get('curedCount'), ' 死亡:', c_dict.get('deadCount')]]))), 0, 48, 1)
oled.show()
from machine import Timer
_status_p = _status_y = _status_t = _status_h = _status_o = _status_n = 0
def on_touchpad_P_pressed():pass
def on_touchpad_P_unpressed():pass
def on_touchpad_Y_pressed():pass
def on_touchpad_Y_unpressed():pass
def on_touchpad_T_pressed():pass
def on_touchpad_T_unpressed():pass
def on_touchpad_H_pressed():pass
def on_touchpad_H_unpressed():pass
def on_touchpad_O_pressed():pass
def on_touchpad_O_unpressed():pass
def on_touchpad_N_pressed():pass
def on_touchpad_N_unpressed():pass
tim12 = Timer(12)
def timer12_tick(_):
global _status_p, _status_y, _status_t, _status_h, _status_o, _status_n
try:
touchPad_P.read();pass
except:
return
if touchPad_P.read() < 400:
if 1 != _status_p:_status_p = 1;on_touchpad_P_pressed()
elif 0 != _status_p:_status_p = 0;on_touchpad_P_unpressed()
if touchPad_Y.read() < 400:
if 1 != _status_y:_status_y = 1;on_touchpad_Y_pressed()
elif 0 != _status_y:_status_y = 0;on_touchpad_Y_unpressed()
if touchPad_T.read() < 400:
if 1 != _status_t:_status_t = 1;on_touchpad_T_pressed()
elif 0 != _status_t:_status_t = 0;on_touchpad_T_unpressed()
if touchPad_H.read() < 400:
if 1 != _status_h:_status_h = 1;on_touchpad_H_pressed()
elif 0 != _status_h:_status_h = 0;on_touchpad_H_unpressed()
if touchPad_O.read() < 400:
if 1 != _status_o:_status_o = 1;on_touchpad_O_pressed()
elif 0 != _status_o:_status_o = 0;on_touchpad_O_unpressed()
if touchPad_N.read() < 400:
if 1 != _status_n:_status_n = 1;on_touchpad_N_pressed()
elif 0 != _status_n:_status_n = 0;on_touchpad_N_unpressed()
tim12.init(period=100, mode=Timer.PERIODIC, callback=timer12_tick)
def on_touchpad_P_pressed():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
p_state = True
y_state = False
t_state = False
h_state = False
o_state = False
n_state = False
state = False
def News():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
if state:
oled.fill(0)
oled.Bitmap(0, 0, bytearray([0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0xc0,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0xf0,0x0f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x9c,0x1f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x86,0x3f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0x9c,0x3f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0xf0,0x3f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x01,0xc0,0x3f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x3f,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x1f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x0f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x1f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x7f,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xff,0xff,0xff,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xfd,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xff,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x01,0x80,0x00,0x30,0x00,0x00,0x00,0xc3,0x80,0x00,0x00,0x00,0x38,0x00,0x01,0x80,0x03,0x80,0x00,0x38,0x00,0xf8,0x00,0x6e,0xc0,0x00,0x00,0x00,0xff,0xc0,0x26,0xc0,0x0c,0xe0,0x00,0x78,0x00,0x70,0x00,0x00,0xc0,0x00,0x00,0x03,0xf9,0xe0,0x78,0x60,0x3f,0x80,0x04,0x3c,0x00,0xce,0x00,0x1c,0xc0,0x00,0x00,0x07,0xc0,0x00,0x70,0x60,0x1c,0xc0,0x0c,0xf8,0x01,0x7b,0x02,0x78,0xc0,0x00,0x00,0x07,0x38,0x00,0x60,0x60,0x0f,0x60,0x0c,0x7e,0x03,0xf6,0x02,0x3c,0xc0,0x00,0x00,0x06,0x1c,0x00,0x7e,0x60,0x4f,0x70,0x2e,0xf0,0x02,0x7e,0x03,0x3c,0xc0,0x00,0x00,0x00,0x24,0x00,0x70,0x60,0x39,0xe0,0x7f,0xac,0x02,0xec,0x03,0x7c,0xc0,0x00,0x00,0x00,0x3f,0x00,0x60,0x60,0x7b,0xe0,0x78,0x7c,0x01,0x50,0x03,0x7e,0xc0,0x00,0x00,0x00,0x3e,0x00,0xef,0xe0,0xdb,0xc0,0x38,0x6c,0x00,0x5f,0x83,0x4c,0xc0,0x00,0x00,0x00,0x0c,0x00,0x7f,0xe0,0xb1,0xc0,0x18,0x7c,0x01,0xd0,0x03,0x0c,0xc0,0x00,0x00,0x00,0x18,0x00,0x61,0xe0,0x73,0xf0,0x18,0xfc,0x0e,0x70,0x01,0x02,0xc0,0x00,0x00,0x00,0x18,0x00,0x20,0xc0,0x6f,0x1e,0x18,0xdc,0x01,0xf8,0x00,0x01,0xc0,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x20,0x02,0x08,0x5c,0x00,0xdc,0x00,0x01,0x80,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]), 128, 64, 1)
oled.show()
if button_a.value() == 0:
state = False
my_list = []
my_dict = {}
_response = urequests.get('http://api.tianapi.com/txapi/ncov/index?key=5299d59a2ae1a0fdfef4d73220d48082', headers={"Content-Type":"application/json"}, data=json.dumps({"item":'data'}))
my_list = _response.json().get('newslist')[0].get('news')
if num < len(my_list):
my_dict = my_list[num]
new = my_dict.get('title')
oled.fill(0)
oled.DispChar(str((''.join([str(x) for x in [new, '——', my_dict.get('infoSource')]]))), 0, 0, 1)
oled.show()
else:
num = 0
num = num + 1
elif button_b.value() == 0:
state = False
my_dict = {}
my_list = []
_response = urequests.get('http://api.tianapi.com/txapi/ncov/index?key=5299d59a2ae1a0fdfef4d73220d48082', headers={"Content-Type":"application/json"}, data=json.dumps({"item":'data'}))
my_list = _response.json().get('newslist')[0].get('news')
if 0 < num:
my_dict = my_list[num]
new = my_dict.get('title')
print(''.join([str(x) for x in [new, '——', my_dict.get('infoSource')]]))
oled.fill(0)
oled.DispChar(str((''.join([str(x) for x in [new, '——', my_dict.get('infoSource')]]))), 0, 0, 1)
oled.show()
num = num + -1
def on_touchpad_Y_pressed():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
p_state = False
y_state = True
t_state = False
h_state = False
o_state = False
n_state = False
state = False
def on_touchpad_T_pressed():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
p_state = False
y_state = False
t_state = True
h_state = False
o_state = False
n_state = False
state = False
def on_touchpad_H_pressed():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
p_state = False
y_state = False
t_state = False
h_state = True
o_state = False
n_state = False
state = True
def TemperatureMeasurement():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
oled.fill(0)
oled.Bitmap(0, 0, bytearray([0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xd0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0xd0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0xd8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x37,0xec,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2f,0xf4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0xfa,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0xfa,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0xfa,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2f,0xf4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x37,0xec,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1b,0xd8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2c,0xc0,0x00,0x80,0x00,0x18,0x00,0x00,0x40,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x80,0x00,0x80,0x20,0x19,0x80,0x00,0x40,0x38,0x04,0x20,0x00,0x00,0x00,0x00,0x2f,0x01,0x00,0x81,0x90,0x19,0x80,0x80,0x40,0x70,0x0c,0x40,0x00,0x00,0x00,0x00,0x3e,0x01,0xb8,0x89,0xf0,0x1f,0xf0,0x5c,0x40,0xf0,0x1c,0x20,0x00,0x00,0x09,0xf0,0x0c,0x00,0x2a,0x8d,0xf0,0x7c,0x70,0x13,0x40,0xf0,0x39,0xe0,0x00,0x00,0x0e,0x30,0x0d,0x00,0x6a,0x88,0xe0,0x3d,0xe0,0x17,0xc0,0x70,0x38,0xc4,0x00,0x00,0x08,0x70,0x1f,0x03,0x7c,0x90,0xb8,0x3f,0x80,0xbe,0x40,0x6c,0x19,0xf4,0x00,0x00,0x08,0xc0,0x1f,0x01,0xbc,0x95,0xe8,0x79,0x70,0xde,0x40,0xf8,0x1b,0xc4,0x00,0x00,0x0f,0xc0,0x0f,0x81,0x68,0x8d,0xf8,0x13,0xf0,0xd6,0x41,0xa0,0x31,0xc6,0x00,0x00,0x07,0x00,0x0e,0x01,0x48,0x8d,0xfe,0x11,0xc0,0xf6,0x41,0x24,0x3b,0xc6,0x00,0x00,0x00,0x00,0x16,0x01,0x00,0x8b,0xd2,0x13,0xf8,0x80,0x41,0x34,0x0f,0x3e,0x00,0x00,0x00,0x00,0x06,0x00,0x01,0x8c,0x00,0x37,0xc0,0x00,0x41,0x60,0x0e,0x18,0x00,0x00,0x00,0x00,0x06,0x00,0x01,0x00,0x00,0x10,0x00,0x00,0x40,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]), 128, 64, 1)
oled.show()
if uart1.any():
msg = uart1.readline().decode('UTF-8','ignore')[1 : -1].split(',')
print(msg)
value = msg[0]
tag = msg[1][2 : -1]
temp = float(round(msg[2], 2))
print(tag)
print(float(value))
print(temp)
if float(value) >= 0.9 and tag == 'mask':
if temp <= 37:
servo_13.write_angle(180)
oled.fill(0)
oled.DispChar(str(('您的体温是:' + str(temp))), 16, 10, 1)
oled.DispChar(str('体温正常请进'), 16, 25, 1)
oled.show()
time.sleep(2)
if tag == 'unmask':
oled.fill(0)
oled.DispChar(str('请佩戴口罩'), 16, 16, 1)
oled.show()
time.sleep(2)
servo_13.write_angle(90)
def on_touchpad_O_pressed():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
p_state = False
y_state = False
t_state = False
h_state = False
o_state = True
n_state = False
state = True
def on_touchpad_N_pressed():
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
p_state = False
y_state = False
t_state = False
h_state = False
o_state = False
n_state = True
state = False
p2 = MPythonPin(2, PinMode.IN)
def on_pin2_to_high(_):
global x, i, p_state, y_state, state, t_state, h_state, o_state, c_dict, c_list, my_list, my_dict, msg, n_state, person_state, value, num, tag, temp, new
uart1.write('person')
time.sleep_ms(200)
def display_font(_font, _str, _x, _y, _wrap, _z=0):
_start = _x
for _c in _str:
_d = _font.get_ch(_c)
if _wrap and _x > 128 - _d[2]: _x = _start; _y += _d[1]
if _c == '1' and _z > 0: oled.fill_rect(_x, _y, _d[2], _d[1], 0)
oled.blit(framebuf.FrameBuffer(bytearray(_d[0]), _d[2], _d[1],
framebuf.MONO_HLSB), (_x+int(_d[2]/_z)) if _c=='1' and _z>0 else _x, _y)
_x += _d[2]
myUI = UI(oled)
def get_seni_weather(_url, _location):
_url = _url + "&location=" + _location.replace(" ", "%20")
response = urequests.get(_url)
json = response.json()
response.close()
return json
servo_13 = Servo(13, min_us=500, max_us=2500, actuation_range=180)
p2.irq(trigger=Pin.IRQ_RISING, handler=on_pin2_to_high)
ntptime.settime(8, "time.windows.com")
w1 = get_seni_weather("https://api.seniverse.com/v3/weather/daily.json?key=SWuW_TLpKSai7AJvK", "hefei")
w2 = get_seni_weather("https://api.seniverse.com/v3/life/suggestion.json?key=SWuW_TLpKSai7AJvK", "hefei")
w3 = get_seni_weather("https://api.seniverse.com/v3/weather/now.json?key=SWuW_TLpKSai7AJvK", "hefei")
servo_13.write_angle(90)
p_state = True
y_state = False
t_state = False
h_state = False
o_state = False
n_state = False
state = True
num = 0
Loading()
while True:
if p_state:
home()
if y_state:
WeatherForecast()
if t_state:
LifeIndex()
if h_state:
News()
if o_state:
EpidemicData()
if n_state:
TemperatureMeasurement()
项目演示