program to receive data using esp8266
Dependencies: ESC ESP8266 mbed
Revision 0:4a98e43af2d0, committed 2016-11-15
- Comitter:
- ninad
- Date:
- Tue Nov 15 12:48:07 2016 +0000
- Commit message:
- -
Changed in this revision
diff -r 000000000000 -r 4a98e43af2d0 ESC.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ESC.lib Tue Nov 15 12:48:07 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/ninad/code/ESC/#162cfef13356
diff -r 000000000000 -r 4a98e43af2d0 ESP8266.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ESP8266.lib Tue Nov 15 12:48:07 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/quevedo/code/ESP8266/#77388e8f0697
diff -r 000000000000 -r 4a98e43af2d0 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Nov 15 12:48:07 2016 +0000 @@ -0,0 +1,74 @@ +#include "mbed.h" +#include "ESP8266.h" + + +ESP8266 esp(PTC4,PTC3,115200); +Serial pc(USBTX, USBRX); + +char rcv[1000]; + +int main () +{ + + char atr[20]; + //char ip[16]; + // esp.CheckAT(atr); + //pc.printf(atr); + + pc.printf("Receiving Wifi List\r\n"); + esp.GetList(rcv); + pc.printf("%s", rcv); + wait(7); + + /*char cmd[100]; + strcpy(cmd, "AT+CWSAP=\"esp_123\",\"1234test\",5,3"); + esp.SendCMD(cmd); + esp.RcvReply(rcv, 2000); + pc.printf("%s", rcv); + wait(10);*/ + + /*pc.printf("Connecting to AP\r\n"); + esp.Join("esp_1", "123testt"); // Replace MyAP and MyPasswd with your SSID and password + esp.RcvReply(rcv, 1000); + pc.printf("%s", rcv); + wait(10); + */ + pc.printf("Setting Mode=2\r\n"); + esp.SetMode(2); + esp.RcvReply(rcv, 1000); + pc.printf("%s", rcv); + wait(5); + + pc.printf("Setting AT+CIPMUX=1\r\n"); + esp.SetMultiple(); + esp.RcvReply(rcv, 1000); + pc.printf("%s", rcv); + wait(5); + + pc.printf("Starting server mode\r\n"); + esp.StartServerMode(333); + esp.RcvReply(rcv, 1000); + pc.printf("%s", rcv); + wait(5); + + pc.printf("Getting IP\r\n"); + esp.GetIP(rcv); + pc.printf("%s", rcv); + wait(10); + + pc.printf("Getting Connection Status\r\n"); + esp.GetConnStatus(rcv); + pc.printf("%s", rcv); + + while(1) + { + /*pc.printf("Getting Connection Status\r\n"); + esp.GetConnStatus(rcv); + pc.printf("%s", rcv); + wait(3);*/ + + esp.RcvReply(rcv, 1000); + pc.printf("%s", rcv); + wait(0.1); + } +} \ No newline at end of file
diff -r 000000000000 -r 4a98e43af2d0 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Nov 15 12:48:07 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/2241e3a39974 \ No newline at end of file