![](/media/cache/profiles/c355b4406b42f9ae5b0199a6e111e85a.jpg.50x50_q85.jpg)
Wifi Pressure Sensor
Dependencies: HTTPClient MPL3115A2 NTPClient TMP102 USBDevice cc3000_hostdriver_mbedsocket mbed
Diff: tcpTests.cpp
- Revision:
- 1:6f4eaec531c4
- Parent:
- 0:0bce3a738bcb
- Child:
- 2:8f5776c287c5
diff -r 0bce3a738bcb -r 6f4eaec531c4 tcpTests.cpp --- a/tcpTests.cpp Mon Nov 04 19:55:00 2013 +0000 +++ b/tcpTests.cpp Mon Nov 04 22:18:14 2013 +0000 @@ -25,8 +25,8 @@ //char XivelyUrl[] = "http://api.xively.com/v2/feeds/1197891669"; char XivelyHostname[] = "api.xively.com"; -char XivelyPath[] = "/v2/feeds/1197891669"; -char XivelyApiKey[] = "jUoEs8IbcqKyREzrjCM84H6CehLRMuiG06jjJ15hG0diR2yk"; +char XivelyPath[] = "/v2/feeds/YOUR-FEED-ID-HERE"; +char XivelyApiKey[] = "YOUR-API-KEY-HERE"; AnalogIn adc0(P0_11); //P2 AnalogIn adc1(P0_12); //P3 @@ -38,7 +38,7 @@ // ------------------------------------------------------------------------------------------------------------ /*! - @brief Post all analog inputs to xively + @brief Post all analog inputs to xively every second */ // ------------------------------------------------------------------------------------------------------------ void XivelySimpleTest ( void ) @@ -67,6 +67,7 @@ httpCmdLen = sprintf(&tmpBuffer[0], "PUT %s.csv HTTP/1.1\r\n", XivelyPath ); httpCmdLen += sprintf(&tmpBuffer[httpCmdLen], "Host: %s\r\nUser-Agent: WiFi-DipCortex\r\n", XivelyHostname); httpCmdLen += sprintf(&tmpBuffer[httpCmdLen], "X-ApiKey: %s\r\n", XivelyApiKey); + // TODO : hardcoded data length of 91, using printf with padding to fix the string length httpCmdLen += sprintf(&tmpBuffer[httpCmdLen], "Content-Type: text/csv\r\nContent-Length: 91\r\n"); httpCmdLen += sprintf(&tmpBuffer[httpCmdLen], "Connection: close\r\n\r\n");