Wifi Pressure Sensor

Dependencies:   HTTPClient MPL3115A2 NTPClient TMP102 USBDevice cc3000_hostdriver_mbedsocket mbed

Revision:
7:3d9d776dc20b
Parent:
6:65fb503512ad
Child:
8:65a5f359a100
--- a/tcpTests.cpp	Tue Jan 07 09:41:00 2014 +0000
+++ b/tcpTests.cpp	Wed Jan 08 05:17:13 2014 +0000
@@ -6,6 +6,7 @@
 #include "TCPSocketServer.h"
 #include "HTTPClient.h"
 #include "Websocket.h"
+#include "TMP102.h"
 
 using namespace mbed_cc3000;
 
@@ -29,7 +30,7 @@
 char XivelyPath[] = "/v2/feeds/601288128";
 char XivelyApiKey[] = "6X82TDHSY7YKSJSraTBmS0nIMwO3W5NOMbVbeKPwwLNBgggw";
 
-//uint32_t number = 0;
+uint32_t number = 0;
 
 AnalogIn adc0(P0_11); //P2
 AnalogIn adc1(P0_12); //P3
@@ -39,6 +40,9 @@
 AnalogIn adc6(P0_22); //P9
 AnalogIn adc7(P0_23); //P10
 
+
+TMP102 temperature(P0_5, P0_4, 0x90); //A0 pin is connected to ground
+
 // ------------------------------------------------------------------------------------------------------------
 /*!
     @brief Post all analog inputs to xively every second
@@ -50,6 +54,7 @@
 int res = 0;
 uint16_t counter = 0;
 int httpCmdLen = 0;
+float tempt = 0;
     
     //if ( wifi.is_connected() )
         
@@ -66,6 +71,13 @@
             socket.set_blocking( true, 1000 );
             counter ++;
 
+            // loop
+            if (number > 10)
+            {number = 0;}
+            else 
+            {number++;}
+            //tempt = temperature.read();
+            
             // Build the header
             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);
@@ -75,9 +87,11 @@
             httpCmdLen += sprintf(&tmpBuffer[httpCmdLen], "Connection: close\r\n\r\n");
             
             // add the data
+            //httpCmdLen += sprintf(&tmpBuffer[httpCmdLen], "Counter, %05d\r\nZig, %05d\r\nTemp, %f\r\n\0", 
+            //    counter, number, tempt);
             httpCmdLen += sprintf(&tmpBuffer[httpCmdLen], "ADC0, %05d\r\nADC1, %05d\r\nADC2, %05d\r\nADC3, %05d\r\nADC5, %05d\r\nADC6, %05d\r\nADC7, %05d\r\n\0", 
-                counter, adc1.read_u16(), adc2.read_u16(), adc3.read_u16(), adc5.read_u16(), adc6.read_u16(), adc7.read_u16());
-                
+            adc0.read_u16(), adc1.read_u16(), adc2.read_u16(), adc3.read_u16(), adc5.read_u16(), adc6.read_u16(), adc7.read_u16());
+              
             pc.printf("Data to be sent : \r\n %s", tmpBuffer);
     
             pc.printf("Posting ADC's to Xively \r\n");