WiFi DipCortex USB CDC
Dependencies: HTTPClient NTPClient USBDevice WebSocketClient cc3000_hostdriver_mbedsocket mbed
Fork of WiFiDip-UsbKitchenSink by
http://www.soldersplash.co.uk/products/wifi-dipcortex/
Demo shows you how to implement the CC3000 library with the WiFi DipCortex.
The demo shows :
- USB CDC ( Serial ) Menu system allow control of the module and starting each example
- Smart Connect
- Manual connect
- Connection status
- Ping
- TCP Client
- TCP Server
- Web Socket read/write to sockets.mbed.org
- HTTP Client test Post, Put, Delete
- Posting ADC data to Xively every 1 second
- UDP Client
- UDP Server
- NTP Example, contacts time server to get the current time
You will need a Driver for the USB CDC port which can be found here : http://www.soldersplash.co.uk/docs/DipCortex-USB-CDC.zip
Please refer to : http://mbed.org/users/SolderSplashLabs/notebook/dipcortex---getting-started-with-mbed/ as well as the SolderSplash Forum for support http://forum.soldersplash.co.uk/viewforum.php?f=15
Revision 1:6f4eaec531c4, committed 2013-11-04
- Comitter:
- SolderSplashLabs
- Date:
- Mon Nov 04 22:18:14 2013 +0000
- Parent:
- 0:0bce3a738bcb
- Child:
- 2:8f5776c287c5
- Commit message:
- Comment changes
Changed in this revision
tcpTests.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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");