Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 1:37707fc10edc, committed 2011-08-03
- Comitter:
- ddamato31
- Date:
- Wed Aug 03 05:57:57 2011 +0000
- Parent:
- 0:a7fdac873af3
- Commit message:
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a7fdac873af3 -r 37707fc10edc main.cpp
--- a/main.cpp Tue Aug 02 19:25:21 2011 +0000
+++ b/main.cpp Wed Aug 03 05:57:57 2011 +0000
@@ -1,32 +1,33 @@
-#include "mbed.h"
-#include "TextLCD.h"
-
-AnalogIn FSR(p17);
-TextLCD lcd(p24, p26, p27, p28, p29, p30);
-float CalEq;
-
-int main() {
-
-// Motor RPM 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};
- int i; i = 0;
-
- while(1) {
-
- // Index and reset Motor Average Counter
- if(i > 9)
- i = 0;
-
-
- CalEq = 1.0;
- ForceV[i] = FSR*CalEq; // 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);
- lcd.printf("Calibrate FSR");
- lcd.locate(0, 1);
- lcd.printf("V=%f", ForceAvg);
- ++i;
- wait(0.25);
- }
-}
+#include "mbed.h"
+#include "math.h"
+#include "TextLCD.h"
+
+AnalogIn FSR(p17);
+TextLCD lcd(p24, p26, p27, p28, p29, p30);
+float CalEq;
+
+int main() {
+
+// Motor RPM average initialization and index
+ 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;
+
+ while(1) {
+
+ // Index and reset Motor Average Counter
+ if(i > 9)
+ i = 0;
+
+
+ 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);
+ lcd.printf("Calibrate FSR");
+ lcd.locate(0, 1);
+ lcd.printf("V=%f", ForceAvg);
+ ++i;
+ wait(0.25);
+ }
+}