Uploading data using node red
Fork of ESP8266-FRDM-KL25Z-THINGSPEAK by
Diff: main.cpp
- Revision:
- 3:beb786f54782
- Parent:
- 2:97dbf542ebee
--- a/main.cpp Sun Dec 03 13:10:28 2017 +0000 +++ b/main.cpp Fri May 25 04:45:05 2018 +0000 @@ -4,7 +4,7 @@ Serial pc(USBTX,USBRX); //POT sensor -AnalogIn pot(PTB0); +AnalogIn pot(PTB2); AnalogIn lit(PTB1); //wifi UART port and baud rate @@ -17,17 +17,17 @@ int timeout = 8000; //timeout for wifi commands //SSID and password for connection -#define SSID "Tenda_43DA50" -#define PASS "Karkhana" +#define SSID "Karkhana" +#define PASS "Karkhana2018" //Remote IP -#define IP "184.106.153.149" // 52.202.122.57 +#define IP "169.50.73.249" // 52.202.122.57 //global variable -float potvalue = 0; +int potvalue = 0; float litvalue = 0; //Update key for thingspeak -char* Update_Key = "P2GMSKA9NY7KV0LW"; +//char* Update_Key = "JYY8CFJCPE1M3DQW"; //Wifi init function void wifi_initialize(void) @@ -99,7 +99,7 @@ wait(1); //create link - sprintf(http_cmd,"/update?api_key=%s&field2=%f&field1=%f",Update_Key,litvalue,potvalue); + sprintf(http_cmd,"/log1?pot=%d", potvalue); pc.printf(http_cmd); @@ -120,6 +120,6 @@ pc.printf("Current potvalue is = %.3f \r\n", potvalue); pc.printf("Current light value is = %.3f \r\n", litvalue); wifi_send(); - wait(30); + wait(10); } } \ No newline at end of file