This is used for sending Data to receiving mDot

Dependencies:   libmDot-dev-mbed5-deprecated sd-driver ISL29011

Fork of mdot-examples by 3mdeb

Revision:
29:0f0a059f023e
Parent:
28:29702434319d
Child:
30:218c795a8081
--- a/send_main.cpp	Tue Apr 10 23:51:44 2018 +0000
+++ b/send_main.cpp	Fri Apr 13 00:08:44 2018 +0000
@@ -1,6 +1,7 @@
 /*
     3/27/2018 mdot version = 3.0.2, mbed version = 5.5.7    WORKS
     3/27/2018 mdot version = 3.1.0, mbed version = 5.7.4    WORKS
+    4/12/2018 mdot version = 3.1.0, mbed version = 5.7.4    Eh
 */
 
 #include <stdlib.h>
@@ -586,7 +587,7 @@
             
             }    
         }
-        
+        pc.printf("Refresh timer: %d\n\r", refresh_Timer.read_ms());
          //check if enough time has passed to warrant printing GPS info to screen
         //note if refresh_Time is too low or pc.baud is too low, GPS data may be lost during printing
         if (refresh_Timer.read_ms() >= refresh_Time) {
@@ -632,6 +633,7 @@
         tx_data.push_back(1);
         tx_data.push_back((convertedTempValue >> 8) & 0xFF);
         tx_data.push_back(convertedTempValue & 0xFF);
+        
         // Push 2 for AccelerometerX
         tx_data.push_back(2);
         tx_data.push_back((XData >> 8) & 0xFF);
@@ -647,6 +649,13 @@
         logInfo("Temperautre: %lu [0x%04X]", convertedTempValue, convertedTempValue);
         send_data(tx_data);
         
+        // Time
+        //tx_data.push_back(7);
+        //tx_data.push_back();
+        // GPS
+        
+        
+        
         
         // Save data
 //        fprintf(fp,"%d,%d,%d,%d,%f,%f,%d/%d/%d,%d:%d:%d:%d\n",
@@ -690,6 +699,8 @@
     myGPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);
     myGPS.sendCommand(PGCMD_ANTENNA);
     
+    refresh_Timer.start();  //starts the clock on the timer
+    
     // current date/time based on current system
     std::time_t now = time(0);
     
@@ -704,6 +715,15 @@
     std::string directory = "sd/mytest/";
     std::string fileName =  directory + file_Date;
     
+    // Show the file name
+    pc.printf("%s\n", fileName.c_str());
+        
+    // Initialize sensors
+    ADT7410Initialize();
+    ADXL372Initialize();
+    
+    
+    
     
     mts::MTSLog::setLogLevel(mts::MTSLog::TRACE_LEVEL);
     
@@ -818,11 +838,11 @@
     
 
 
-    //below is acc,temp sensors
-    ADT7410Initialize();
-    ADXL372Initialize();
+    // //below is acc,temp sensors
+    // ADT7410Initialize();
+    // ADXL372Initialize();
     
-    pc.printf("%s\n", fileName);
+
     
 //    // Initialize the SD card
 //    if(sd.init() == 0)
@@ -901,7 +921,7 @@
         
         // Go to sleep for 5 seconds and wake up after 5 seconds or wakeup from interrupt
         
-        if(dot->sleep(1,mDot::RTC_ALARM_OR_INTERRUPT, false) == mDot::MDOT_OK)
+        if(dot->sleep(5,mDot::RTC_ALARM_OR_INTERRUPT, false) == mDot::MDOT_OK)
         {
            pc.printf("Sleep well\n\r");
         }
@@ -980,12 +1000,16 @@
 ////////////////////////////////////////////////////////////////////////////////
 void ADT7410Initialize(void){
     pc.printf("Initializing ADT7410 Temperature\n\r");
+    // Make INT/CRIT pins comp mode and both pins active HIGH
+    ADT7410Write(0x03, 0x1A);   //
     // Make critical temperature be 24 celsius
     ADT7410Write(0x08, 0x01);   // MSB of Temperature Crit value
     ADT7410Write(0x09, 0x80);   // LSB of Temperature Crit value
     
+    // 
+    
     // Make CRIT pin active high
-    ADT7410Write(0x03, 0x08);   // Turn INT HIGH, works for the interrupt pin
+    //ADT7410Write(0x03, 0x08);   // Turn INT HIGH, works for the interrupt pin
     pc.printf("\n\n\r");
 }
 ////////////////////////////////////////////////////////////////////////////////