【项目背景】
去了一次北京大兴国际机场,虽然有指路牌,但还是被搞得乱七八糟,绕了好久才找到登机口,差点赶掉飞机!!!
【软硬件】
硬件:
· 行空板*1
· 行空板双电路驱动IO扩展板*1
· Gravity HUSKYLENS 人工智能摄像头*1
· DHT11 数字温湿度传感器V2*1
· 马达*2
软件:
· Mind+ V1.8.0 RC3.1
·
【项目设想】
1、开机后,首页内容包括机场背景图、标题、按钮; 2、按下”自助托运“,则可以使用Husky自动识别机票信息;
3、按下”安检须知“则可显示安检须知图片。
【硬件连接】
【项目实现】
- # -*- 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
复制代码
【结尾】