![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Kuo Yiching
Fork of iot_example by
Diff: esp8266.cpp
- Revision:
- 8:cd472721e8a8
- Parent:
- 7:49a823b5a935
diff -r 49a823b5a935 -r cd472721e8a8 esp8266.cpp --- a/esp8266.cpp Wed Dec 13 10:09:44 2017 +0000 +++ b/esp8266.cpp Wed Dec 20 08:46:09 2017 +0000 @@ -52,6 +52,8 @@ else if(strcmp(token, "control") == 0){ if(!control_cmd){ strncpy(control_buf, param, sizeof(control_buf)); + ser2usb.printf("%s\r\n", control_buf); + control_cmd = true; } } @@ -63,9 +65,10 @@ bool Esp8266::get_control_cmd(char* actuator, char* value) { + if(!control_cmd) return false; - + char* plus = strchr(control_buf, '+'); if(!plus){ control_cmd = false;