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
Diff: main.cpp
- Revision:
- 108:2cf8d5159fc6
- Parent:
- 107:5e3364e42214
- Child:
- 109:33d7fc6c1b9b
--- a/main.cpp Thu Feb 11 15:39:49 2016 +0000 +++ b/main.cpp Thu Feb 11 17:58:15 2016 +0000 @@ -189,7 +189,7 @@ //pc.printf("%02d:%02d:%02d on %d/%d/%d before fmod \r\n",RTC.hour, RTC.minutes, RTC.seconds, RTC.month, RTC.date, RTC.year);//debug //*****************************************// secondsD = RTC.seconds; - + /* while(fmod(secondsD,logInerval)!=0 || floor(secondsD)==floor(lastsecondD)) { //pc.printf("%f, %f\r\n", floor(secondsD), floor(lastsecondD)); RTC.get_time(); @@ -197,10 +197,11 @@ wait_ms(100); } lastsecondD = secondsD; - //*****************************************// + // //RTC.get_time(); //debug //pc.printf("%02d:%02d:%02d on %d/%d/%d after fmod \r\n",RTC.hour, RTC.minutes, RTC.seconds, RTC.month, RTC.date, RTC.year);//debug - //*****************************************// + // + */ omronReading = ads.readADC_SingleEnded(0, 0xC583); // read channel 0 PGA = 2 : Full Scale Range = 2.048V omronVolt = (omronReading*4.096)/(32768*2); @@ -266,6 +267,17 @@ 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); + fprintf(fp, "%1.3f,%5.1f,%1.1f,%1.1f,%1.1f,%1.1f,", volflow, sampledVol, accel_x, accel_y, accel_z, accel_comp); + 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); + fclose(fp); + + /* 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); @@ -277,6 +289,7 @@ //fprintf(fp, "%f,%f,%f,%f,%f\r\n", calibrations.MF4, calibrations.MF3, calibrations.MF2, calibrations.MF1, calibrations.MF0); fclose(fp); //wait_ms(5); + */ } /*EEPROM ADDRESSING: @@ -477,7 +490,7 @@ E2PROM.read(0x00034, flowRateOriginal,2); serial_num = ((uint16_t)flowRateOriginal[1] << 8) | flowRateOriginal[0]; //---------------------------------------------- - calibrations.initialize(5); + calibrations.initialize(6); //---------------------------------------------- wait(1); blower=1;