Skeleton program for Federico's 4YP project.

Dependencies:   WebSocketClient WiflyInterface mbed messages

Fork of IoT_Ex by Damien Frost

Revision:
2:7abdaa5a9209
Parent:
1:4403f2ed1c1f
Child:
3:f20e114eb2ee
--- a/main.cpp	Tue Oct 04 13:19:19 2016 +0000
+++ b/main.cpp	Tue Oct 04 13:59:13 2016 +0000
@@ -5,7 +5,7 @@
 #include "Websocket.h"
 #include "ADC.h"
 
-#define DEBUG
+//#define DEBUG
 #define INFOMESSAGES
 #define WARNMESSAGES
 #define ERRMESSAGES
@@ -17,6 +17,7 @@
     unsigned int wifi_cmd = NO_WIFI_CMD;
     float wifi_data = 0.0f;
     unsigned int wifi_var = 0;
+    unsigned int ADCRaw;
     
     // Set the IoT ID:
     IoT_ID = 1;
@@ -27,7 +28,7 @@
     INFO("Starting up...");
     INFO("CPU SystemCoreClock is %d Hz", SystemCoreClock); 
         
-    
+    ConfigureADC();
     SetupNetwork(5000);
     // Configure the baud rate of the wifi shield:
     ws.setBaud(115200);
@@ -84,9 +85,10 @@
             // Sample the internal temperature sensor:
             STARTADCCONVERSION;
             while(!ADCCONVERSIONCOMPLETE);
-            TempSensor = ((((float)ADC1->JDR1)/ADC_MAX)*IT_VMAX - IT_V25)/IT_AVG_SLOPE + 25.0f;
+            ADCRaw = ADC1->DR;
+            TempSensor = ((((float)ADCRaw)/ADC_MAX)*IT_VMAX - IT_V25)/IT_AVG_SLOPE + 25.0f;
             DBG("TempSensor = %.5f", TempSensor);
-            DBG("ADC1->JDR1 = %d", ADC1->JDR1);
+            DBG("ADC1->DR = %d", ADCRaw);
             
             // Send data over network:
             SendNetworkData();               
@@ -96,6 +98,12 @@
             
             // Reset the timer:
             DisplayTimer.reset();
+            
+            if(Led == 1){
+                Led = 0;
+            }else{
+                Led = 1;
+            }
         }