Code supports writing to the SD card as well as working with the Volckens group smartphone apps for the mbed HRM1017

Dependencies:   ADS1115 BLE_API BME280 Calibration CronoDot EEPROM LSM303 MCP40D17 NCP5623BMUTBG SDFileSystem SI1145 STC3100 mbed nRF51822

Fork of UPAS_BLE_and_USB by Volckens Group Sensors

Revision:
106:3911b3c7a24e
Parent:
105:f3be9e0314f7
Child:
107:5e3364e42214
--- a/main.cpp	Fri Jan 22 02:19:28 2016 +0000
+++ b/main.cpp	Wed Feb 10 06:25:53 2016 +0000
@@ -244,6 +244,7 @@
     } else {
         RGB_LED.set_led(0,1,0);
     }
+    
     movementsensor.getACCEL();
     movementsensor.getCOMPASS();
     compass = movementsensor.getCOMPASS_HEADING();
@@ -254,6 +255,7 @@
     mag_x = movementsensor.MagData.x;
     mag_y = movementsensor.MagData.y;
     mag_z = movementsensor.MagData.z;
+    
     vInReading = ads.readADC_SingleEnded(1, 0xD583); // read channel 0
     vBlowerReading = ads.readADC_SingleEnded(2, 0xE783); // read channel 0
     omronDiff = ads.readADC_Differential(0x8583); // differential channel 2-3
@@ -263,7 +265,7 @@
     uv =  lightsensor.getUV();
     vis = lightsensor.getVIS();
     ir = lightsensor.getIR();
-    
+   
     FILE *fp = fopen(filename, "a");
     fprintf(fp, "%02d,%02d,%02d,%02d,%02d,%02d,",RTC.year, RTC.month,RTC.date,RTC.hour,RTC.minutes,RTC.seconds);
     fprintf(fp, "%1.3f,%1.3f,%2.2f,%4.2f,%2.1f,%1.3f,", omronVolt,massflow,temp,press,rh,atmoRho);
@@ -271,6 +273,8 @@
     fprintf(fp, "%.1f,%.1f,%.1f,%.3f,%.3f,%.3f,%.1f,", angle_x,angle_y,angle_z,mag_x, mag_y, mag_z,compass);
     fprintf(fp, "%d,%d,%d,%d,%d,%d," ,uv,omronReading, vInReading, vBlowerReading, omronDiff,gasG.getAmps());
     fprintf(fp, "%d,%d,%d,%1.3f,%1.3f\r\n", gasG.getVolts(), gasG.getCharge(),digital_pot_set, deltaMflow, deltaVflow);
+    //fprintf(fp, "%d,%f,", serial_num, volflowSet);
+    //fprintf(fp, "%f,%f,%f,%f,%f\r\n", calibrations.MF4, calibrations.MF3, calibrations.MF2, calibrations.MF1, calibrations.MF0); 
     fclose(fp);
     //wait_ms(5);
     
@@ -373,6 +377,7 @@
     
     //outer loop commented out to prevent mem issues
     //if(presetRunModeCheck[0] != 0x0C){
+       
         while (1) {
             ble.waitForEvent();
              
@@ -385,6 +390,7 @@
                pbKill = 0;
            }
         }
+        
     //}else{
 //        RunReady = 12;
 //    }
@@ -400,6 +406,8 @@
             RTC.get_time(); 
 
     }
+    
+    
     //Commented out to prevent mem issues
     //MARK: editting 24 hour mode code here
     //if(RunReady == 12) {
@@ -468,7 +476,8 @@
     //Get the proper serial number
     E2PROM.read(0x00034, flowRateOriginal,2);    
     serial_num = ((uint16_t)flowRateOriginal[1] << 8) | flowRateOriginal[0];
-    calibrations.initialize(serial_num);
+    calibrations.initialize(17);
+    wait(1);
     blower=1;
     E2PROM.read(0x00014,logIntervalReadOut,1);
     logInerval = logIntervalReadOut[0];