Denwis La / Mbed OS mDot_Send_Data

Dependencies:   libmDot-dev-mbed5-deprecated ISL29011

Fork of mdot-examples by 3mdeb

Revision:
21:d96ef380a5d3
Parent:
20:dba07b7d9675
Child:
22:388f97cf422a
--- a/copy_main.cpp	Mon Dec 11 00:26:24 2017 +0000
+++ b/copy_main.cpp	Wed Jan 10 16:35:54 2018 +0000
@@ -85,6 +85,7 @@
 uint8_t frequency_band;
 
 
+
 /*
  *  Variables used for ADXL372 Accelerometer
  */
@@ -195,7 +196,7 @@
     pc.baud(115200);
     ADXL372.frequency(300000);  // I2C devices are connected to the same clock
     ADT7410.frequency(300000);  // Redundant but whatever
-    ADT7410_Int.rise(&CriticalTemperatureInterrupt);
+    ADT7410_Int.fall(&CriticalTemperatureInterrupt);
     
     
     mts::MTSLog::setLogLevel(mts::MTSLog::TRACE_LEVEL);
@@ -315,6 +316,8 @@
     //Periodic.attach(&takePeriodicReading,3);
     
     while(1){
+        // Create a vector of uint8_t elements to be sent later
+        std::vector<uint8_t> tx_data;
         pc.printf("Regular looped reading ");
         /*
          *  Taking accelerometer data
@@ -351,6 +354,13 @@
         pc.printf("Temperature::: ");
         pc.printf("Celsius: 0x%x\n\r", convertedTempValue);
         
+        
+        
+        tx_data.push_back((convertedTempValue >> 8) & 0xFF);
+        tx_data.push_back(convertedTempValue & 0xFF);
+        logInfo("Temperautre: %lu [0x%04X]", convertedTempValue, convertedTempValue);
+        send_data(tx_data);
+        
         if(takeAccelerometer || takeAccelerometer){
             pc.printf("INTERRUPTEDDDDDDDD: ");
             if(takeAccelerometer) pc.printf("Temperature triggered\n\r");
@@ -398,7 +408,7 @@
         }
         
         
-        
+        wait(1);
     }
     
     return 0;