QAQ ==!
Dependencies: mbed QEI-1 nRF24L01P xiugai
Diff: main.cpp
- Revision:
- 10:cda7ae2fc9de
- Parent:
- 8:ec92c8510ece
- Child:
- 11:ddfcd88f3a30
--- a/main.cpp Wed Nov 13 09:14:24 2019 +0000 +++ b/main.cpp Thu Nov 14 02:05:58 2019 +0000 @@ -4,15 +4,32 @@ #include <string> typedef bool boolean; typedef std::string String; +#include "SYN6288.h" #include "esp8266.h" +#include "converters.h" + +String item; +char led[20] ; +char value[20] ; + +Serial syn6288_Serial_3(PC_10,PC_11); +Serial Serial_2(PA_2,PA_3); int main() { -Esp8266 Esp8266client_(PB_6, PA_10, "iot_xxx", "12345678"); -const char* esp8266sensors_[][2] = {{"light",""},{"switch",""},{NULL,NULL}}; -const char* esp8266actuators_[][2] = {{"door",""},{"motor",""},{NULL,NULL}}; -Esp8266client_.connect_mqtt_broker("192.168.12.1", "node1", esp8266sensors_, esp8266actuators_); -Esp8266client_.publish_value("light", "0"); +Serial_2.baud(9600); + +Esp8266 Esp8266client_(PA_9, PA_10, "iot_b827ebd838be", "ab087c9e"); +const char* esp8266sensors_[][2] = {{NULL,NULL}}; +const char* esp8266actuators_[][2] = {{"led",""},{NULL,NULL}}; +Esp8266client_.connect_mqtt_broker("192.168.12.1", "node2", esp8266sensors_, esp8266actuators_); +while (true) { +while (!Esp8266client_.get_control_cmd(led, value)) { +} +item = "\xb9\xfe\xb9\xfe\xb9\xfe"; +item += String(String(value)); +voice_play(item,&syn6288_Serial_3); +} } \ No newline at end of file