本帖最后由 驴友花雕 于 2023-12-17 20:19 编辑
本例实验的TM1650四位数码管模块
本例实验的TM1650四位数码管模块的电原理图
本例实验采用DHT11模块
是一款含有已校准数字信号输出的温湿度复合传感器。它应用专用的数字模块采集技术和温湿度传感技术,确保产品具有极高的可靠性与卓越的长期稳定性。传感器包括一个电阻式感湿元件和一个NTC测温元件,并与一个高性能8位单片机相连接。因此该产品具有品质卓越、超快响应、抗干扰能力强、性价比极高等优点。每个DHT11传感器都在极为精确的湿度校验室中进行校准。校准系数以程序的形式储存在OTP内存中,传感器内部在检测信号的处理过程中要调用这些校准系数。单线制串行接口,使系统集成变得简易快捷。超小的体积、极低的功耗,信号传输距离可达20米以上,使其成为各类应用甚至最为苛刻的应用场合的最佳选则。产品为4针单排引脚封装。连接方便,特殊封装形式可根据用户需求而提供。
【花雕动手做】实验十六:用TM1650数码管显示实时温度与湿度数值
实验开源代码
- #include "asr.h"
- extern "C"{ void * __dso_handle = 0 ;}
- #include "setup.h"
- #include "myLib/asr_tm1650.h"
- #include "myLib/asr_dhtxx.h"
- #include "myLib/asr_event.h"
-
- uint32_t snid;
- uint8_t _E6_B8_A9_E5_BA_A6;
- uint8_t _E6_B9_BF_E5_BA_A6;
- void app();
- void ASR_CODE();
- void hardware_init();
-
- //{ID:250,keyword:"命令词",ASR:"最大音量",ASRTO:"音量调整到最大"}
- //{ID:251,keyword:"命令词",ASR:"中等音量",ASRTO:"音量调整到中等"}
- //{ID:252,keyword:"命令词",ASR:"最小音量",ASRTO:"音量调整到最小"}
- TM1650 tm1650_11_12(11,12);
- DHTxx asr_dht_3(3, DHT11);
- void app(){
- while (1) {
- _E6_B8_A9_E5_BA_A6 = asr_dht_3.read_temperature(0);
- delay(2000);
- _E6_B9_BF_E5_BA_A6 = asr_dht_3.readHumidity();
- delay(2000);
- if((_E6_B8_A9_E5_BA_A6 == 0) && (_E6_B9_BF_E5_BA_A6 == 0)){
- tm1650_11_12.display_num(1111);
- delay(200);
- enter_wakeup(5000);
- delay(200);
- //{ID:500,keyword:"命令词",ASR:"耍接官",ASRTO:"请关闭电源十秒再上电。"}
- play_audio(500);
- }
- else{
- tm1650_11_12.display_time(_E6_B9_BF_E5_BA_A6,_E6_B8_A9_E5_BA_A6,(1));
- }
- }
- vTaskDelete(NULL);
- }
-
- /*描述该功能...
- */
- void ASR_CODE(){
- tm1650_11_12.clear();
- tm1650_11_12.display_num((snid));
- switch (snid) {
- case 2:
- //{ID:501,keyword:"命令词",ASR:"接耍官",ASRTO:"当前温度"}
- play_audio(501);
- play_num((int64_t)(_E6_B8_A9_E5_BA_A6 * 100), 1);
- //{ID:502,keyword:"命令词",ASR:"官耍接",ASRTO:"摄氏度"}
- play_audio(502);
- break;
- case 3:
- //{ID:503,keyword:"命令词",ASR:"丝耍接",ASRTO:"当前湿度,百分之"}
- play_audio(503);
- play_num((int64_t)(_E6_B9_BF_E5_BA_A6 * 100), 1);
- break;
- }
- //{ID:504,keyword:"命令词",ASR:"还不错",ASRTO:"谢谢鼓励"}
- if(snid == 504){
-
- }
- }
-
- void hardware_init(){
- tm1650_11_12.begin();
- tm1650_11_12.display_num(0);
- asr_dht_3.init();
- xTaskCreate(app,"app",256,NULL,4,NULL);
- vTaskDelete(NULL);
- }
-
- void setup()
- {
- //{speak:可可-欢快女童,vol:20,speed:10,platform:haohaodada}
- //{playid:10001,voice:欢迎使用人工智能AI语音助手,用智能管家唤醒我}
- //{playid:10002,voice:我退下了,用智能管家唤醒我}
- //{ID:1,keyword:"唤醒词",ASR:"智能管家",ASRTO:"我在"}
- //{ID:2,keyword:"命令词",ASR:"当前温度",ASRTO:""}
- //{ID:3,keyword:"命令词",ASR:"当前湿度",ASRTO:""}
- pinMode(4,output);
- setPinFun(4,FIRST_FUNCTION);
-
- //{ID:84,keyword:"命令词",ASR:"条耍改",ASRTO:"零"}
- //{ID:85,keyword:"命令词",ASR:"官接思",ASRTO:"一"}
- //{ID:86,keyword:"命令词",ASR:"痛官松",ASRTO:"二"}
- //{ID:87,keyword:"命令词",ASR:"削丝误",ASRTO:"三"}
- //{ID:88,keyword:"命令词",ASR:"景粮载",ASRTO:"四"}
- //{ID:89,keyword:"命令词",ASR:"博菌避",ASRTO:"五"}
- //{ID:90,keyword:"命令词",ASR:"裁纯碉",ASRTO:"六"}
- //{ID:91,keyword:"命令词",ASR:"插趣悟",ASRTO:"七"}
- //{ID:92,keyword:"命令词",ASR:"辞暖慌",ASRTO:"八"}
- //{ID:93,keyword:"命令词",ASR:"纵猛淡",ASRTO:"九"}
- //{ID:94,keyword:"命令词",ASR:"锦耗暂",ASRTO:"十"}
- //{ID:95,keyword:"命令词",ASR:"燃智截",ASRTO:"百"}
- //{ID:96,keyword:"命令词",ASR:"佛驻延",ASRTO:"千"}
- //{ID:97,keyword:"命令词",ASR:"隔枪绍",ASRTO:"万"}
- //{ID:98,keyword:"命令词",ASR:"惨愤昂",ASRTO:"亿"}
- //{ID:99,keyword:"命令词",ASR:"丙迈扯",ASRTO:"负"}
- //{ID:100,keyword:"命令词",ASR:"铸猜隆",ASRTO:"点"}
- xTaskCreate(hardware_init,"hardware_init",256,NULL,100,NULL);
- }
复制代码
实验场景图
训练模型与编译烧录
实验记录视频
https://www.bilibili.com/video/BV1wj411W7HE/?share_source=copy_web&vd_source=371a292a55e5ca9be994cbb4a86cc987
|