Rajas Chitanvis
/
ESP8266_test
thingspeak using ESP8266 wifi module
Diff: main.cpp
- Revision:
- 2:817794b2f733
- Parent:
- 1:2012c31aee1b
- Child:
- 3:164296bb4985
diff -r 2012c31aee1b -r 817794b2f733 main.cpp --- a/main.cpp Fri Jun 24 02:22:53 2016 +0000 +++ b/main.cpp Sun Jun 26 10:19:24 2016 +0000 @@ -20,14 +20,14 @@ #define PASS "eduvance" //Remote IP -#define IP "192.168.0.13" +#define IP "192.168.0.2" //ldrvalue global variable float ldrval = 0; //Public and private keys for phant -char* Public_Key = "wyJD1Pza1OCk1QEKk9K9C10zdyj3"; -char* Private_Key = "OrxMl9BLlOCvPZdBv4B4H3mDOAlx"; +char* Public_Key = "eaWkxgdlQZszLEDKpy6OFeDeO8x"; +char* Private_Key = "25xqpAeBmzSml4Yjpr05Hj3jOBq"; //Wifi init function void wifi_initialize(void){ @@ -61,10 +61,6 @@ pc.printf("%s",resp); else pc.printf("No response while getting IP \r\n"); - -} - -void wifi_send(void){ pc.printf("******** Setting WIFI UART passthrough ********\r\n"); wifi.setTransparent(); @@ -72,7 +68,7 @@ pc.printf("%s",resp); else pc.printf("No response while setting wifi passthrough. \r\n"); - wait(1); + wait(1); pc.printf("******** Setting single connection mode ********\r\n"); wifi.SetSingle(); @@ -82,6 +78,9 @@ else pc.printf("No response while setting single connection \r\n"); wait(1); +} + +void wifi_send(void){ pc.printf("******** Starting TCP connection on IP and port ********\r\n"); wifi.startTCPConn(IP, 8080); //cipstart @@ -94,6 +93,7 @@ //create link sprintf(http_cmd,"/input/%s?private_key=%s&val=%0.2f",Public_Key,Private_Key,ldrval); + pc.printf(http_cmd); pc.printf("******** Sending URL to wifi ********\r\n"); wifi.sendURL(http_cmd, comm); //cipsend and get command