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:
- 8:204c21adf693
- Parent:
- 7:a24d7156bc02
- Child:
- 9:2057c3779b6a
--- a/main.cpp Wed May 06 04:08:03 2015 +0000 +++ b/main.cpp Tue May 12 17:29:53 2015 +0000 @@ -17,18 +17,21 @@ BMP280 bmpsensor(p22, p20); STC3100 gasG(p22, p20); Serial pc(USBTX, USBRX); -DigitalOut blower(p29, 1); +DigitalOut blower(p29, 0); +AnalogIn Honeywell(P0_2); //Timer t; //float battAmps; //float battVolts; //float battGG; + +float Honeywell_value; int omronReading; int vInReading; int vBlowerReading; int omronDiff; -int digital_pot_setpoint = 0x46; //min = 0x7F, max = 0x00 +int digital_pot_setpoint = 0x07; //min = 0x7F, max = 0x00 char filename[] = "/sd/UPASLOG00.txt"; TwoWire Wire = TwoWire(NRF_TWI0); @@ -79,9 +82,12 @@ //t.start(); // create a new file - - Wire.begin(SCL, SDA, TWI_FREQUENCY_100K);// + + DigPot.writeRegister(digital_pot_setpoint); + Wire.begin(SCL, SDA, TWI_FREQUENCY_100K);// wait(1); + blower = 1; + wait (1); for (uint8_t i = 0; i < 100; i++) { @@ -100,7 +106,8 @@ while(1){ - get_time(); + get_time(); + Honeywell_value = Honeywell.read(); omronReading = ads.readADC_SingleEnded(0, 0xC583); // read channel 0 PGA = 2 : Full Scale Range = 2.048V //omronReading = ads.readADC_SingleEnded(0, 0xC183); // read channel 0 PGA = 1 : Full Scale Range = 4.096V vInReading = ads.readADC_SingleEnded(1, 0xD583); // read channel 0 @@ -113,7 +120,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\r\n", Year,Month,Date,Hour,Minutes,Seconds,omronReading,vInReading, vBlowerReading, omronDiff, gasG.getAmps(), gasG.getVolts(), gasG.getCharge(), bmpsensor.getTemperature(), bmpsensor.getPressure()); + fprintf(fp, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%2.2f,%04.2f,%f\r\n", Year,Month,Date,Hour,Minutes,Seconds,omronReading,vInReading, vBlowerReading, omronDiff, gasG.getAmps(), gasG.getVolts(), gasG.getCharge(), bmpsensor.getTemperature(), bmpsensor.getPressure(),Honeywell_value); fclose(fp); //Unmount the filesystem sd.unmount();