Colin Monroe
/
CKM_algorithmsMidterm_Q2
CKM algorithms midterm: Question 2
Revision 2:1771e1827f75, committed 2016-10-09
- Comitter:
- CKMonroe
- Date:
- Sun Oct 09 05:47:40 2016 +0000
- Parent:
- 1:859677d7ccb4
- Commit message:
- Final revision after tests of precision of slider (program remains the same)
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 859677d7ccb4 -r 1771e1827f75 main.cpp --- a/main.cpp Sun Oct 09 05:36:34 2016 +0000 +++ b/main.cpp Sun Oct 09 05:47:40 2016 +0000 @@ -67,10 +67,19 @@ //press right button - SELECT MODE (red led) if (displayState == 0){ + + //turn on red led rled = 0.0; gled = 1.0; - sprintf (lcdData,"%2.1f",tsidata*100); + //send data to LCD + //note that the tsidata read from the slider + //only reads 2 digits past the decimal (i.e. 0.88) + //as a percentage. Therefore, if we have the slider + //reach a max value of 100, i do not think the slider + //is precise enough to still be able to measure a value + //as precise as 0.1 to use for a step. + sprintf (lcdData,"%2.1f",tsidata*100 ); //if statement to read tsi if(dataTimer.read() > DATAINTERVAL){ @@ -87,11 +96,14 @@ } //end if statement for display state = 0 //press left button - CALC MODE (green led) else if (displayState == 1){ + //turn on red led rled = 1.0; gled = 0.0; + //multiply tsidata percentage by 100 float data = tsidata*100; + //initialize variables for calculation float xOld = 0.0; float xNew = 0.0;