Prototype
Dependencies: mbed
Revision 0:818d3faeb71f, committed 2017-02-13
- Comitter:
- keithbehrman
- Date:
- Mon Feb 13 20:53:18 2017 +0000
- Commit message:
- First prototype
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 818d3faeb71f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 13 20:53:18 2017 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" + +DigitalOut myled(LED1); +AnalogIn ain(PB_0); +Serial pc(USBTX, USBRX); // tx, rx + +double resistinput; +double bridgeR1=218.14; +double bridgeR2=218.96; +double bridgeR3=218.46; +double gainR12=20000; +double gainR34=46200; +double bridgePotential; +double sourceVoltage=5.0; +double strainResist; +double wheatstonePotential; +double dynamicRangePotential; + +int main() { + + dynamicRangePotential=sourceVoltage*(bridgeR3/(bridgeR3+bridgeR2)); + + + while(1) { + + resistinput=ain.read(); + wheatstonePotential=sourceVoltage*resistinput*gainR12/gainR34; + bridgePotential=wheatstonePotential+dynamicRangePotential; + strainResist=-bridgeR1*bridgePotential/(bridgePotential-sourceVoltage); + + pc.printf("Resistance= %f \n", strainResist); + wait(1); + } +} +
diff -r 000000000000 -r 818d3faeb71f mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Feb 13 20:53:18 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5 \ No newline at end of file