
Exp5_ForceFeedback
Dependencies: TextLCD mbed Servo
Revision 1:3168e55bf2da, committed 2011-08-03
- Comitter:
- ddamato31
- Date:
- Wed Aug 03 05:58:23 2011 +0000
- Parent:
- 0:41736722ccb8
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 41736722ccb8 -r 3168e55bf2da main.cpp --- a/main.cpp Tue Aug 02 22:48:23 2011 +0000 +++ b/main.cpp Wed Aug 03 05:58:23 2011 +0000 @@ -21,7 +21,7 @@ Servo.pulsewidth_us(1500); // Force average initialization and index - float ForceV[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; + double ForceV[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; int i; i = 0; int squeeze; squeeze = 1250; @@ -33,8 +33,8 @@ i = 0; - //CalEq = 1.0; - ForceV[i] = 97.6207*exp(FSR) ; // Use AnalogIn (FSR) reading in an equation of Force versus FSR values + double FSRconst = FSR; + ForceV[i] = 6.3713*pow(97.6207, FSRconst) ; // Use AnalogIn (FSR) reading in an equation of Force versus FSR values float ForceAvg = (ForceV[0] + ForceV[1] + ForceV[2] + ForceV[3] + ForceV[4] + ForceV[5] + ForceV[6] + ForceV[7] + ForceV[8] + ForceV[9]) / 10 ; lcd.cls(); lcd.locate(0, 0);