Chenkai Shao
/
FSR_hello_world
FSR
Diff: main.cpp
- Revision:
- 0:5521da8243b8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 22 17:36:14 2015 +0000 @@ -0,0 +1,14 @@ +#include "mbed.h" +#include "FSR.h" + +FSR fsr(p20, 10); // Pin 20 is used as the AnalogIn pin and a 10k resistor is used as a voltage divider + +int main(){ + while (1) + { + printf("The raw data is %f\n", fsr.readRaw()); + printf("The resistance of the FSR is %f\n", fsr.readFSRResistance()); + printf("The weight on the FSR is %f\n\n", fsr.readWeight()); + wait(0.3); //just here to slow down the output for easier reading + } +} \ No newline at end of file