k jm / Mbed OS thingspark example

Dependencies:   MbedJSONValue mbed-http HTS221

Revision:
37:e809fd407dc9
Parent:
36:3c86e52c9e75
Child:
38:7734b54de565
--- a/source/main-http.cpp	Mon Oct 21 06:49:02 2019 +0000
+++ b/source/main-http.cpp	Mon Oct 21 11:56:25 2019 +0000
@@ -11,8 +11,8 @@
 static DevI2C devI2c(PB_11,PB_10);
 static HTS221Sensor hum_temp(&devI2c);
 //theKsystemsURL = "https://api.theksystem.com/update?apiKey=9Q8vOz1lguaV6Ou4&field1=21"
-char* theKsystemsURL = "http://api.theksystem.com";
-char* theKsystemsAPIkey = "9Q8vOz1lguaV6Ou4";
+char* thingspark_URL = "http://api.thingspark.kr";
+char* thingspark_APIkey = "hKqQALm22Hd79N6I";
 char urlBuffer[256];
 
 void dump_response(HttpResponse* res) {
@@ -30,7 +30,7 @@
     unsigned int updateCnt=0;
     float hum_val=12, temp_val=34;
     
-    printf("DISCO-L457VG-IOT01A WiFi + TheKsystem example\r\n");
+    printf("DISCO-L457VG-IOT01A WiFi + thingspark example\r\n");
 
 #ifdef MBED_MAJOR_VERSION
     printf("Mbed OS version %d.%d.%d\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
@@ -54,11 +54,11 @@
     printf("Gateway: %s\n", network->get_gateway());
 
     printf("<< =========== Sensor check.. =========== >>\r\n");
-    unsigned int a=0;
+    
     hum_temp.init(NULL);
     hum_temp.enable();
 
-    // Do a GET request to httpbin.org
+    // Do a GET request to thingspark.kr
     while(1){
         // By default the body is automatically parsed and stored in a buffer, this is memory heavy.
         // To receive chunked response, pass in a callback as last parameter to the constructor.
@@ -66,7 +66,7 @@
         hum_temp.get_humidity(&hum_val);
         hum_temp.get_temperature(&temp_val);
         printf("HT221 hum: %.1f %, temp: %.1f C\n", hum_val, temp_val);
-        sprintf(urlBuffer, "%s/update?apiKey=%s&field1=%.1f&field2=%.1f", theKsystemsURL, theKsystemsAPIkey, hum_val, temp_val);
+        sprintf(urlBuffer, "%s/update?apiKey=%s&field1=%.1f&field2=%.1f", thingspark_URL, thingspark_APIkey, hum_val, temp_val);
 
         printf("[DEBUG] %s\n", urlBuffer);
         HttpRequest* get_req = new HttpRequest(network, HTTP_GET, urlBuffer);
@@ -81,8 +81,8 @@
         dump_response(get_res);
 
         delete get_req;
-        printf("\nUpdate count %d (Every 10sec, data update to theK server)\n",updateCnt++);
-        wait(10);
+        printf("\nUpdate count %d (Every 30sec, data update to thingspark server)\n",updateCnt++);
+        wait(30);
     }
 #if 0
     // POST request to httpbin.org