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:
- 4:69bd7e8a994c
- Parent:
- 3:2d059d88582b
- Child:
- 5:0edf35b6d79a
diff -r 2d059d88582b -r 69bd7e8a994c main.cpp --- a/main.cpp Sun May 03 13:55:01 2015 +0000 +++ b/main.cpp Sun May 03 15:25:51 2015 +0000 @@ -11,6 +11,8 @@ Serial pc(USBTX, USBRX); DigitalOut blower(p29, 1); +Timer t; + int omronReading; int vInReading; int vBlowerReading; @@ -23,6 +25,7 @@ int main() { +t.start(); // create a new file for (uint8_t i = 0; i < 100; i++) { @@ -43,7 +46,6 @@ while(1){ omronReading = ads.readADC_SingleEnded(0, 0xC583); // read channel 0 - //pc.printf("Omron Reading: %d\r\n", omronReading); // print reading 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 @@ -51,12 +53,12 @@ //Mount the filesystem sd.mount(); FILE *fp = fopen(filename, "a"); - fprintf(fp, "%d,%d,%d,%d\r\n", omronReading,vInReading, vBlowerReading, omronDiff); + fprintf(fp, "%f,%d,%d,%d,%d\r\n", t.read(),omronReading,vInReading, vBlowerReading, omronDiff); fclose(fp); //Unmount the filesystem sd.unmount(); - wait(5); + wait(5); DigPot.writeRegister(digital_pot_setpoint);