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
Revision 124:15466d0f04ab, committed 2016-03-05
- Comitter:
- caseyquinn
- Date:
- Sat Mar 05 21:14:28 2016 +0000
- Parent:
- 123:2765e75fd0a6
- Commit message:
- "Fixed" the digital pot cutout issue by not allow large digital pot jumps while the boost is turned on. Also limited the lowest digital pot setting to 5.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2765e75fd0a6 -r 15466d0f04ab main.cpp --- a/main.cpp Sat Mar 05 19:11:27 2016 +0000 +++ b/main.cpp Sat Mar 05 21:14:28 2016 +0000 @@ -345,6 +345,7 @@ digital_pot_setpoint = digitalpotMin; } + pc.printf("%d\r\n", digitalpotMin); DigPot.writeRegister(digital_pot_setpoint); wait(1); blower = 1; @@ -355,7 +356,7 @@ sprintf(filename, "/sd/UPAS%04dLOG_%02d-%02d-%02d_%02d=%02d=%02d_%c%c%c%c%c%c%c%c.txt",serial_num,RTC.year,RTC.month,RTC.date,RTC.hour,RTC.minutes,RTC.seconds,subjectLabelOriginal[0],subjectLabelOriginal[1],subjectLabelOriginal[2],subjectLabelOriginal[3],subjectLabelOriginal[4],subjectLabelOriginal[5],subjectLabelOriginal[6],subjectLabelOriginal[7]); FILE *fp = fopen(filename, "w"); fclose(fp); - + pc.printf("hello"); //---------------------------------------------------------------------------------------------// //Following lines are needed to enter into the initiallization flow control loop @@ -377,7 +378,7 @@ //---------------------------------------------------------------------------------------------// //Sets the flow withen +-1.5% of the desired flow rate based on mass flow - while(abs(deltaMflow)>.015) { + while(abs(deltaMflow)>.025) { omronReading = ads.readADC_SingleEnded(0, 0xC583); // read channel 0 PGA = 2 : Full Scale Range = 2.048V omronVolt = (omronReading*4.096)/(32768*2); @@ -404,6 +405,7 @@ wait(2); DigPot.writeRegister(digital_pot_set); + pc.printf("%d,\r\n", digital_pot_set); wait(1); @@ -458,25 +460,24 @@ digital_pot_change = (int)(gainFlow*deltaMflow); - if(abs(digital_pot_change)>=50) { - digital_pot_set = (int)(digital_pot_set+(int)((10.0*deltaMflow))); + if(abs(digital_pot_change)>=10) { + digital_pot_set = (int)(digital_pot_set+ (int)(1*deltaMflow)); RGB_LED.set_led(1,0,0); - } else { + } else { digital_pot_set = (digital_pot_set+ digital_pot_change); RGB_LED.set_led(1,1,0); } - if(digital_pot_set>=digitalpotMax) { - digital_pot_set = digitalpotMax; - RGB_LED.set_led(1,0,0); - } else if(digital_pot_set<=digitalpotMin) { - digital_pot_set = digitalpotMin; - RGB_LED.set_led(1,0,0); - } - + if(digital_pot_set>=digitalpotMax) { + digital_pot_set = digitalpotMax; + RGB_LED.set_led(1,0,0); + } else if(digital_pot_set<=digitalpotMin) { + digital_pot_set = digitalpotMin; + RGB_LED.set_led(1,0,0); + } DigPot.writeRegister(digital_pot_set); - + } else { RGB_LED.set_led(0,1,0); }