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:
- 115:fb25810c1fab
- Parent:
- 114:84e759e07948
- Child:
- 116:5ab9d74cfb6d
- Child:
- 117:074ebef2dc12
diff -r 84e759e07948 -r fb25810c1fab main.cpp --- a/main.cpp Thu Feb 18 01:02:00 2016 +0000 +++ b/main.cpp Thu Feb 18 03:43:35 2016 +0000 @@ -3,7 +3,7 @@ #include "Adafruit_ADS1015.h" #include "MCP40D17.h" #include "STC3100.h" -//#include "LSM303.h" +#include "LSM303.h" #include "BME280.h" #include "SI1145.h" #include "NCP5623BMUTBG.h" @@ -36,7 +36,7 @@ Serial pc(USBTX, USBRX); DigitalOut blower(p29, 0); DigitalOut pbKill(p18, 1); -//LSM303 movementsensor(p22, p20); +LSM303 movementsensor(p22, p20); SI1145 lightsensor(p22, p20); NCP5623BMUTBG RGB_LED(p22, p20); CronoDot RTC(p22, p20); @@ -61,7 +61,7 @@ int vis; int ir; -/* + float compass; float accel_x; float accel_y; @@ -73,7 +73,7 @@ float mag_x; float mag_y; float mag_z; -*/ + int vInReading; int vBlowerReading; @@ -571,7 +571,7 @@ RGB_LED.set_led(0,1,0); } - /* + movementsensor.getACCEL(); movementsensor.getCOMPASS(); compass = movementsensor.getCOMPASS_HEADING(); @@ -582,7 +582,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 @@ -597,9 +597,8 @@ 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,", volflow, sampledVol); - // 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, "%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);