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.
main.cpp
00001 #include "mbed.h" 00002 #include "math.h" 00003 #include "TextLCD.h" 00004 00005 AnalogIn FSR(p17); 00006 TextLCD lcd(p24, p26, p27, p28, p29, p30); 00007 float CalEq; 00008 00009 int main() { 00010 00011 // Motor RPM average initialization and index 00012 double ForceV[10] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; 00013 int i; i = 0; 00014 00015 while(1) { 00016 00017 // Index and reset Motor Average Counter 00018 if(i > 9) 00019 i = 0; 00020 00021 00022 double FSRconst = FSR; 00023 ForceV[i] = 6.3713*pow(97.6207, FSRconst) ; // Use AnalogIn (FSR) reading in an equation of Force versus FSR values 00024 float ForceAvg = (ForceV[0] + ForceV[1] + ForceV[2] + ForceV[3] + ForceV[4] + ForceV[5] + ForceV[6] + ForceV[7] + ForceV[8] + ForceV[9]) / 10 ; 00025 lcd.cls(); 00026 lcd.locate(0, 0); 00027 lcd.printf("Calibrate FSR"); 00028 lcd.locate(0, 1); 00029 lcd.printf("V=%f", ForceAvg); 00030 ++i; 00031 wait(0.25); 00032 } 00033 }
Generated on Tue Jul 12 2022 23:48:55 by
1.7.2