- # -*- coding: UTF-8 -*-
-
- # MindPlus
- # Python
- import threading
- from unihiker import GUI
- from pinpong.board import Board
- from pinpong.board import DHT11
- from pinpong.board import Board,Pin
- from pinpong.extension.unihiker import *
- from pinpong.libs.dfrobot_huskylens import Huskylens
-
- # 自定义函数
- def ZhuoMian():
- global button2,button3,button4
- u_gui.draw_image(image="背景.jpg",x=0,y=0)
- u_gui.draw_round_rect(x=20,y=100,w=100,h=50,r=5,width=1,color="#0000FF")
- u_gui.draw_round_rect(x=130,y=100,w=100,h=50,r=5,width=1,color="#0000FF")
- u_gui.draw_text(text="温度:",x=20,y=100,font_size=15, color="#0000FF")
- u_gui.draw_text(text="湿度:",x=130,y=100,font_size=15, color="#0000FF")
- wendu=u_gui.draw_digit(text="1234",x=60,y=110,font_size=13, color="#0000FF")
- shidu=u_gui.draw_digit(text="1234",x=170,y=110,font_size=13, color="#0000FF")
- u_gui.draw_text(text="(°C)",x=20,y=130,font_size=10, color="#0000FF")
- u_gui.draw_text(text="(%rh)",x=130,y=130,font_size=10, color="#0000FF")
- u_gui.draw_text(text="欢迎使用智慧机场服务",x=10,y=30,font_size=16, color="#0000FF")
- u_gui.draw_text(text="自助托运",x=0,y=160,font_size=13, color="#0000FF")
- button2=u_gui.add_button(text="托运行李",x=80,y=160,w=80,h=30,onclick=button_click2)
- u_gui.draw_text(text="安检1",x=0,y=200,font_size=13, color="#0000FF")
- button3=u_gui.add_button(text="安检须知",x=75,y=200,w=80,h=30,onclick=button_click3)
- u_gui.draw_text(text="安检2",x=0,y=240,font_size=13, color="#0000FF")
- button4=u_gui.add_button(text="安检须知",x=75,y=240,w=80,h=30,onclick=button_click4)
- while True:
- wendu.config(text=round(dht1.temp_c(),2))
- shidu.config(text=round(dht1.humidity(),2))
- def picture():
- u_gui.draw_image(image="安检 (1).jpg",x=0,y=0)
- threading.Timer(5, ZhuoMian).start()
-
- # 事件回调函数
- def button_click2():
- u_gui.draw_image(image="背景.jpg",x=0,y=0)
- button2.config(x=10000)
- button3.config(x=10000)
- button4.config(x=10000)
- n = 0
- while not ((n >= 1)):
- p_huskylens.command_request()
- if p_huskylens.is_appear(1, "blocks"):
- u_gui.draw_text(text="请确认您的信息",x=0,y=0,font_size=20, color="#0000FF")
- u_gui.draw_text(text="航班号:3U6780",x=0,y=40,font_size=20, color="#0000FF")
- u_gui.draw_text(text="姓名:A/Mr.",x=0,y=80,font_size=20, color="#0000FF")
- u_gui.draw_text(text="登机口:3",x=0,y=120,font_size=20, color="#0000FF")
- n = (n + 1)
- u_gui.draw_text(text="-----------------------------",x=0,y=140,font_size=20, color="#0000FF")
- u_gui.draw_text(text="正在打印行李凭条,请稍候",x=0,y=160,font_size=14, color="#0000FF")
- break
- elif p_huskylens.is_appear(2, "blocks"):
- u_gui.draw_text(text="请确认您的信息",x=0,y=0,font_size=20, color="#0000FF")
- u_gui.draw_text(text="航班号:KN5428",x=0,y=40,font_size=20, color="#0000FF")
- u_gui.draw_text(text="姓名:B/Ms.",x=0,y=80,font_size=20, color="#0000FF")
- u_gui.draw_text(text="登机口:2",x=0,y=120,font_size=20, color="#0000FF")
- n = (n + 1)
- u_gui.draw_text(text="-----------------------------",x=0,y=140,font_size=20, color="#0000FF")
- u_gui.draw_text(text="正在打印行李凭条,请稍候",x=0,y=160,font_size=14, color="#0000FF")
- break
- elif p_huskylens.is_appear(3, "blocks"):
- u_gui.draw_text(text="请确认您的信息",x=0,y=0,font_size=20, color="#0000FF")
- u_gui.draw_text(text="航班号:MU2471",x=0,y=40,font_size=20, color="#0000FF")
- u_gui.draw_text(text="姓名:C/Mr.",x=0,y=80,font_size=20, color="#0000FF")
- u_gui.draw_text(text="登机口:1",x=0,y=120,font_size=20, color="#0000FF")
- n = (n + 1)
- u_gui.draw_text(text="-----------------------------",x=0,y=140,font_size=20, color="#0000FF")
- u_gui.draw_text(text="正在打印行李凭条,请稍候",x=0,y=160,font_size=14, color="#0000FF")
- break
- threading.Timer(20, ZhuoMian).start()
- def button_click4():
- button2.config(x=10000)
- button3.config(x=10000)
- button4.config(x=10000)
- u_gui.draw_image(image="安检 (2).jpg",x=0,y=0)
- threading.Timer(5, picture).start()
- def button_click3():
- button2.config(x=10000)
- button3.config(x=10000)
- button4.config(x=100000)
- u_gui.draw_image(image="安检须知.png",x=0,y=0)
-
-
- Board().begin()
- u_gui=GUI()
- p_huskylens = Huskylens()
- dht1 = DHT11(Pin((Pin.P21)))
- ZhuoMian()
-
- while True:
- pass
复制代码
【结尾】
此款扩展板有4路I2C口,可以满足4个传感器的连接,比如语音识别和语音模块可以同时使用。安排的10路3Pin,也非常给力。最喜欢的设计是USB转接,可以保证扩展板稳定供电的同时,还能调试程序。因为之前的扩展板如果要接语音识别模块,需要另外外接电源,连接线增多,不方便,现在就方便多了。
不过usb连接线是真难弄,希望df能把这里改一下。------------------------------------------------------------------------------------------------------------------------------------------------------------------------------完结撒花