Zeheng Chen
/
funky
heart rate test
Diff: main.cpp
- Revision:
- 5:6db460f13fcc
- Parent:
- 4:3edb2dedc40b
- Child:
- 6:95e2e305e802
--- a/main.cpp Tue Apr 14 03:28:30 2015 +0000 +++ b/main.cpp Tue Apr 14 04:04:24 2015 +0000 @@ -21,7 +21,7 @@ int running_count=0; bool foundMax = false; bool firstRun = true; -#define difference 0.05 +float difference = 0.05; #define count_period 0.1 void reset(); float normalization(); @@ -65,7 +65,7 @@ } } else if(data - previous_data < 0 && foundMax){ - if((max1-data < difference && max1-data > -1*difference)){ + if(((max1-data) < difference && (max1-data) > -1*difference)){ //found second max; printf("max1 = %f\n",max1); printf("found second max,data = %f \n",data); @@ -111,6 +111,7 @@ if(data_input > max_input)max_input = data_input; wait_ms(50); } + difference = max_input * 0.2; return max_input; }