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:
- 14:ad550174db8b
- Parent:
- 13:a8e096e715bd
- Child:
- 15:3d1322f05b8e
--- a/main.cpp Thu May 21 03:30:40 2015 +0000 +++ b/main.cpp Fri May 29 14:21:23 2015 +0000 @@ -6,6 +6,7 @@ #include "STC3100.h" #include "LSM303.h" #include "BME280.h" +#include "SI1145.h" #define SERIAL_BAUD_RATE 9600 #define SCL 20 @@ -20,6 +21,7 @@ Serial pc(USBTX, USBRX); DigitalOut blower(p29, 0); LSM303 movementsensor(p22, p20); +SI1145 lightsensor(p22, p20); //Timer t; @@ -38,7 +40,7 @@ int vInReading; int vBlowerReading; int omronDiff; -int digital_pot_setpoint = 0x07; //min = 0x7F, max = 0x00 +int digital_pot_setpoint = 0x46; //min = 0x7F, max = 0x00 char filename[] = "/sd/UPASLOG00.txt"; TwoWire Wire = TwoWire(NRF_TWI0); @@ -140,7 +142,7 @@ //Mount the filesystem sd.mount(); FILE *fp = fopen(filename, "a"); - fprintf(fp, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%2.2f,%04.2f,%2.2f,%.0f,%.0f,%.0f,%.0f,%.0f,%.0f\r\n", Year,Month,Date,Hour,Minutes,Seconds,omronReading,vInReading, vBlowerReading, omronDiff, gasG.getAmps(), gasG.getVolts(), gasG.getCharge(), bmesensor.getTemperature(), bmesensor.getPressure(),bmesensor.getHumidity(),accel_x, accel_y, accel_z, mag_x, mag_y, mag_z); + fprintf(fp, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%2.2f,%04.2f,%2.2f,%.0f,%.0f,%.0f,%.0f,%.0f,%.0f,%d,%d,%d\r\n", Year,Month,Date,Hour,Minutes,Seconds,omronReading,vInReading, vBlowerReading, omronDiff, gasG.getAmps(), gasG.getVolts(), gasG.getCharge(), bmesensor.getTemperature(), bmesensor.getPressure(),bmesensor.getHumidity(),accel_x, accel_y, accel_z, mag_x, mag_y, mag_z, lightsensor.getUV(), lightsensor.getVIS(), lightsensor.getIR()); fclose(fp); //Unmount the filesystem sd.unmount();