Skeleton program for Federico's 4YP project.
Dependencies: WebSocketClient WiflyInterface mbed messages
Fork of IoT_Ex by
Diff: main.cpp
- Revision:
- 1:4403f2ed1c1f
- Parent:
- 0:c5607b31fb07
- Child:
- 2:7abdaa5a9209
--- a/main.cpp Tue Oct 04 11:34:47 2016 +0000 +++ b/main.cpp Tue Oct 04 13:19:19 2016 +0000 @@ -1,10 +1,11 @@ #include "mbed.h" -#include "iQ_globals.h" +#include "globals.h" #include "WiflyInterface.h" -#include "iQ_Commands.h" +#include "Commands.h" #include "Websocket.h" +#include "ADC.h" -//#define DEBUG +#define DEBUG #define INFOMESSAGES #define WARNMESSAGES #define ERRMESSAGES @@ -21,6 +22,8 @@ IoT_ID = 1; // Send a startup message to serial port: + INFO(""); + INFO(""); INFO("Starting up..."); INFO("CPU SystemCoreClock is %d Hz", SystemCoreClock); @@ -78,6 +81,12 @@ // Send the network data every 3 seconds: if(DisplayTimer.read()>(3.0f)){ + // Sample the internal temperature sensor: + STARTADCCONVERSION; + while(!ADCCONVERSIONCOMPLETE); + TempSensor = ((((float)ADC1->JDR1)/ADC_MAX)*IT_VMAX - IT_V25)/IT_AVG_SLOPE + 25.0f; + DBG("TempSensor = %.5f", TempSensor); + DBG("ADC1->JDR1 = %d", ADC1->JDR1); // Send data over network: SendNetworkData();