pengfei wu
/
ESP8266Program
For test
Diff: ESP8266.cpp
- Revision:
- 18:37254b357abd
- Parent:
- 17:c449356787f1
- Child:
- 20:43451f36281e
diff -r c449356787f1 -r 37254b357abd ESP8266.cpp --- a/ESP8266.cpp Wed Feb 04 03:06:54 2015 +0000 +++ b/ESP8266.cpp Wed Feb 04 09:07:22 2015 +0000 @@ -8,25 +8,13 @@ return chlID; } -void ESP8266::begin(void) +bool ESP8266::begin(void) { - bool result = false; esp_uart.begin(9600); //The default baud rate of ESP8266 is 115200 - esp_uart.flush(); esp_uart.setTimeout(5000); esp_uart.println("AT+RST"); - logInfo("AT+RST\r\n"); - result = esp_uart.find("eady"); - - if(result) - logInfo("Module is ready\r\n"); - else - { - logInfo("Module have no response\r\n"); - while(1); - } - + return esp_uart.find("eady"); } @@ -238,9 +226,8 @@ unsigned long start; start = millis(); while (millis()-start<5000) { - if(esp_uart.find("ready")==true) + if(esp_uart.find("eady")==true) { - logInfo("reboot wifi is OK\r\n"); break; } }