摘要:錯開折騰經歷文章目錄前言思路設備配置程序代碼小愛訓練測試總結前言之前已經進行了項目二接入小愛同學以及項目三空調控制,接下來便是將二者合一,實現控制,溫濕度查看,以及小愛同學進行簡單空調控制。
錯開の折騰經歷:ESP8266 NodeMCU
之前已經進行了項目二:DHT11接入小愛同學以及項目三:空調控制,接下來便是將二者合一,實現app控制,溫濕度查看,以及小愛同學進行簡單空調控制。
滴滴:以下是本篇文章正文內容
實現app+小愛雙控制
將設備偽裝為燈(就讓小愛同學把咱設備定義為燈),然后自定義燈模式函數實現多狀態控制空調。
官方參考鏈接:
接入小愛同學の幫助文檔
官方示例文件
可以從以上資料中看見以下的模式函數,我們要做的就是將其進行魔改!
void miotMode(uint8_t mode){ BLINKER_LOG("need set mode: ", mode); if (mode == BLINKER_CMD_MIOT_DAY) { // Your mode function } else if (mode == BLINKER_CMD_MIOT_NIGHT) { // Your mode function } else if (mode == BLINKER_CMD_MIOT_COLOR) { // Your mode function } else if (mode == BLINKER_CMD_MIOT_WARMTH) { // Your mode function } else if (mode == BLINKER_CMD_MIOT_TV) { // Your mode function } else if (mode == BLINKER_CMD_MIOT_READING) { // Your mode function } else if (mode == BLINKER_CMD_MIOT_COMPUTER) { // Your mode function } wsMode = mode; BlinkerMIOT.mode(mode); BlinkerMIOT.print();}
緊接著上一項目的空調控制器設備進行更改,增加新組建,實現更多功能
配置代碼如下:
{¨version¨¨2.0.0¨¨config¨{¨headerColor¨¨transparent¨¨headerStyle¨¨dark¨¨background¨{¨img¨¨assets/img/headerbg.jpg¨¨isFull¨?}}¨dashboard¨|{¨type¨¨tex¨¨t0¨¨空調控制器¨¨t1¨¨以指定狀態運行¨¨size¨¨22¨¨bg¨ê¨ico¨¨fad fa-air-conditioner¨¨cols¨í¨rows¨?¨key¨¨tex-cnl¨′x′é′y′?¨speech¨|÷¨lstyle¨ì¨clr¨¨#076EEF¨}{?C¨btn¨?L¨fad fa-snowflakes¨¨mode¨é?E¨25℃、制冷、高鳳¨?G¨文本2¨?K??Ní?Oí?P¨btn-on¨′x′é′y′D?R|÷?S??T?U}{?C?V?L?W?Xé?E¨25℃、制冷、自動風¨?G?Z?K??Ní?Oí?P¨btn-on-auto¨′x′í′y′D?R|÷?S??T?U}{?C?V?L?W?Xé?E¨26℃、制冷、最大風¨?G?Z?K??Ní?Oí?P¨btn-26¨′x′é′y′¤B?R|÷?T?U?S?}{?C?V?L¨fad fa-power-off¨?Xé?E¨關機¨?G?Z?K??Ní?Oí?P¨btn-off¨′x′í′y′¤B?R|÷?S??T?U}{?C¨deb¨?Xé?Ké?N??Oì?P¨debug¨′x′é′y′??R|÷}{?C¨num¨?E¨溫度¨?L¨fad fa-thermometer-three-quarters¨?T?U¨min¨é¨max¨¢1c¨uni¨′℃′?Kê?N??O??P¨temp¨′x′í′y′??R|÷?Sé}{?C?k?E¨濕度¨?L¨fad fa-humidity¨?T?U?né?oo0?p′%′?Kê?N??O??P¨humi¨′x′?′y′??R|÷}÷¨actions¨|÷¨triggers¨|÷}
代碼如下:
#define BLINKER_PRINT Serial#define BLINKER_WIFI#define BLINKER_MIOT_LIGHT //小愛同學定義為燈#include #include //紅外頭文件 #include //點燈科技頭文件#include //DHT11傳感器的頭文件 #define DHTPIN 4 //定義DHT11模塊連接管腳GPIO4(D2腳)#define DHTTYPE DHT11 // 使用DHT11溫度濕度模塊char auth[] = "";//這里面填寫設備的密鑰char ssid[] = "";//這里填寫你的wifi名字char pswd[] = "";//這里填寫你的WiFi密碼//定義紅外發射的管腳const uint16_t kIrLed = 14; // 設置kIrLed為GPIO14,D5腳IRsend irsend(kIrLed); // 將kIrLed設置發送信息//空調開:25、制冷、大風uint16_t power_on[199] = {5998, 7318, 478, 1712, 540, 1622, 474, 1712, 542, 1622, 474, 1712, 542, 1620, 474, 1714, 542, 1622, 474, 596, 568, 532, 456, 618, 568, 532, 476, 598, 570, 532, 478, 596, 570, 532, 478, 1712, 542, 1622, 474, 1712, 542, 1622, 474, 1712, 542, 1622, 474, 1714, 542, 1622, 474, 598, 568, 532, 456, 618, 568, 532, 478, 598, 568, 532, 478, 596, 570, 532, 478, 1712, 544, 1622, 474, 1714, 542, 1622, 474, 1712, 544, 1622, 474, 1712, 544, 1622, 474, 598, 570, 532, 456, 618, 568, 532, 476, 600, 566, 532, 478, 602, 566, 530, 478, 1710, 546, 532, 456, 1732, 522, 556, 454, 1732, 546, 532, 526, 1660, 546, 1622, 526, 576, 514, 1650, 476, 626, 514, 1646, 478, 626, 548, 1612, 510, 594, 554, 522, 506, 596, 552, 1610, 506, 1660, 576, 524, 504, 1662, 572, 528, 502, 1664, 566, 1622, 502, 1664, 562, 536, 504, 574, 536, 1652, 504, 576, 534, 1654, 504, 596, 508, 570, 502, 598, 506, 1660, 502, 598, 506, 1660, 502, 598, 504, 1664, 498, 600, 502, 600, 476, 1692, 474, 626, 472, 1718, 448, 630, 470, 1720, 448, 630, 470, 1720, 448, 1720, 470, 7384, 446}; // GOODWEATHER D5292A000000//空調開:25、制冷、自動風uint16_t power_on_auto[199] = {6036, 7330, 476, 1716, 514, 1650, 474, 1716, 516, 1650, 474, 1716, 514, 1652, 520, 1670, 514, 1652, 524, 550, 542, 560, 456, 650, 514, 558, 476, 628, 514, 560, 478, 628, 514, 560, 476, 1718, 514, 1652, 474, 1716, 516, 1650, 476, 1716, 514, 1652, 474, 1716, 514, 1652, 474, 600, 540, 562, 456, 648, 514, 560, 476, 628, 512, 562, 478, 598, 540, 562, 456, 624, 538, 1654, 452, 622, 540, 1654, 452, 1738, 512, 1654, 452, 1738, 512, 1652, 454, 1738, 514, 562, 476, 1718, 514, 560, 456, 650, 514, 560, 476, 630, 512, 562, 476, 1718, 514, 560, 478, 1716, 514, 560, 478, 1718, 512, 1654, 454, 1738, 514, 1652, 454, 650, 510, 1654, 474, 630, 512, 1652, 504, 600, 514, 560, 508, 598, 514, 560, 506, 600, 512, 1652, 504, 1688, 514, 560, 508, 1686, 516, 560, 506, 1686, 516, 1652, 504, 1686, 518, 558, 506, 596, 542, 1624, 506, 596, 546, 1622, 528, 574, 552, 524, 558, 544, 580, 1586, 556, 548, 578, 1586, 562, 540, 578, 1586, 560, 546, 576, 500, 526, 1640, 602, 502, 552, 1614, 602, 500, 524, 1640, 602, 502, 498, 1668, 574, 1616, 502, 7332, 456}; // GOODWEATHER D5290A050000//空調開:26、制冷、大風uint16_t power_on_26[199] = {6062, 7302, 476, 1718, 538, 1628, 474, 1716, 540, 1626, 454, 1740, 514, 1650, 472, 1718, 516, 1650, 452, 620, 542, 560, 528, 546, 544, 560, 456, 620, 544, 560, 458, 618, 544, 558, 478, 1716, 516, 1650, 452, 1740, 514, 1650, 454, 1738, 516, 1650, 474, 1718, 514, 1652, 454, 618, 544, 558, 458, 620, 542, 560, 456, 620, 544, 560, 456, 620, 544, 560, 528, 1668, 516, 558, 476, 1718, 540, 1626, 476, 1716, 516, 1650, 454, 1738, 516, 1650, 474, 600, 544, 1650, 476, 598, 544, 560, 476, 602, 542, 560, 476, 604, 540, 560, 456, 1740, 514, 560, 476, 1718, 538, 536, 456, 1740, 538, 536, 456, 1738, 516, 1650, 476, 628, 514, 1652, 454, 648, 514, 1652, 454, 648, 514, 1652, 476, 626, 516, 562, 506, 1684, 546, 532, 532, 1660, 552, 524, 556, 1634, 582, 496, 560, 1634, 580, 1584, 562, 542, 580, 1584, 560, 544, 578, 1586, 530, 574, 576, 1588, 530, 576, 548, 526, 504, 602, 546, 1618, 504, 576, 568, 1620, 502, 578, 564, 1624, 504, 576, 562, 536, 502, 1666, 538, 562, 504, 1666, 536, 564, 504, 1666, 534, 566, 502, 1690, 510, 1658, 504, 7332, 502}; // GOODWEATHER D52A2A020000//空調關:uint16_t power_off[199] = {6022, 7290, 476, 1714, 510, 1650, 472, 1714, 512, 1650, 518, 1668, 510, 1652, 472, 1714, 512, 1650, 474, 626, 510, 560, 454, 648, 512, 562, 474, 598, 542, 562, 476, 598, 540, 560, 476, 1714, 512, 1650, 472,
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://m.specialneedsforspecialkids.com/yun/121964.html
摘要:紅外模塊接入板子后,可進行以上操作,并接入,通過控制空調。材料清單板子紅外接收模塊紅外發射模塊線杜邦線左邊是紅外發射模塊,右邊是紅外接收模塊。 錯開の折騰經歷:ES...
摘要:教程傳送門基于平臺開發連接巴法云簡介實驗準備硬件軟件實驗步驟點燈實驗發送溫濕度指令升級總結關于巴法云專注于開源,智造,創新,分享。 Arduino教程傳送門????...
摘要:前言芯片接口占用管腳數量比以太網的少,版線布局可更精簡。網卡芯片介紹接口網卡芯片是為方物聯網行業進以太網通信而開發出的解決方案。此應用可用于監控家庭物聯網網關搭建等。 前言 ????DM9051NP芯片?SPI接口占用管腳數量比以太網PHY的RMII/MII少,PCBA版線布局可更精簡。...
摘要:它主要包括以下幾部分采用對文本進行文法分析,生成語法樹。對語法樹進一步進行分析,類似程序編譯器的語義分析,對語法合格的進一步進行檢查。優化器對語法樹應用各種規則,生成不同的執行計劃,形成一個搜索空間。 Trafodion簡介 Trafodion是一個構建在Hadoop/HBase基礎之上的關系型數據庫,它完全開源免費。Trafodion能夠完整地支持ANSI SQL,并且提供ACID事...
閱讀 1952·2021-11-19 09:40
閱讀 2141·2021-10-09 09:43
閱讀 3298·2021-09-06 15:00
閱讀 2817·2019-08-29 13:04
閱讀 2773·2019-08-26 11:53
閱讀 3532·2019-08-26 11:46
閱讀 2327·2019-08-26 11:38
閱讀 396·2019-08-26 11:27