Includes support for IKS01A1 per HelloWorld_IKS01A1

Dependencies:   NetworkSocketAPI X_NUCLEO_IDW01M1v2 X_NUCLEO_IKS01A1 mbed

Fork of Nucleo_read_a0_thingspace by Tom Amershek

Revision:
2:553393c6c088
Parent:
1:c0a277c96fd6
--- a/main.cpp	Thu Nov 03 20:37:46 2016 +0000
+++ b/main.cpp	Fri Nov 04 11:26:16 2016 +0000
@@ -100,7 +100,7 @@
     
     float panel_voltage;
     DigitalOut led(LED1);
-    serial_port.baud(9600);
+    serial_port.baud(115200);
     
     printf("\r\n\r\n*** system restart");
     printf("\r\n\r\nanalog0 example using thingspace.io ...\n");
@@ -192,10 +192,11 @@
         sprintf(gyroBuff, "&gyroscope0=%ld&gyroscope1=%ld&gyroscope2=%ld", axes[0], axes[1], axes[2]);
         readings = readings + gyroBuff;
         
-        printf(readings.c_str());
+        // printf(readings.c_str());
           
         panel_voltage = analog_input_A0.read();
         // printf("voltage:  %f\r\n", panel_voltage);
+        
         // A0 is voltage tolerant to 3.3V, and analog read returns a percentage of the maximum
         // need to convert the percentage back to a representative number
         panel_voltage = panel_voltage * 3300; // change the value to be in the 0 to 3300 range
@@ -219,17 +220,16 @@
             // create GET HTTP header for dweeting
             strcpy(dweetBuffer, "GET /dweet/for/nucleo-");     
             // uncomment to use the last 6 digits of WiFi MAC
-            // strcat(dweetBuffer, macBytes);
-            strcat(dweetBuffer, "toma");    
-            char valueRead[32];
-            sprintf(valueRead, "?voltage=%f&units=millivolts", panel_voltage);
+            strcat(dweetBuffer, macBytes);
+            char valueRead[16];
+            sprintf(valueRead, "?a0=%f", panel_voltage);
             strcat(dweetBuffer, valueRead);
             strcat(dweetBuffer, readings.c_str());
             strcat(dweetBuffer, " HTTP/1.1\r\n\r\n"); 
                        
             serial_port.printf("\r\n%s", dweetBuffer);
 
-            char bufferRx[512] = "";
+            char bufferRx[1024] = "";
             int countRx = 0;
             serial_port.printf("sending and receiving data ...\r\n");
             errSend = socket.send(dweetBuffer, strlen(dweetBuffer));