FSR

Dependencies:   FSR mbed

Committer:
cshao06
Date:
Thu Oct 22 17:36:14 2015 +0000
Revision:
0:5521da8243b8
FSR

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cshao06 0:5521da8243b8 1 #include "mbed.h"
cshao06 0:5521da8243b8 2 #include "FSR.h"
cshao06 0:5521da8243b8 3
cshao06 0:5521da8243b8 4 FSR fsr(p20, 10); // Pin 20 is used as the AnalogIn pin and a 10k resistor is used as a voltage divider
cshao06 0:5521da8243b8 5
cshao06 0:5521da8243b8 6 int main(){
cshao06 0:5521da8243b8 7 while (1)
cshao06 0:5521da8243b8 8 {
cshao06 0:5521da8243b8 9 printf("The raw data is %f\n", fsr.readRaw());
cshao06 0:5521da8243b8 10 printf("The resistance of the FSR is %f\n", fsr.readFSRResistance());
cshao06 0:5521da8243b8 11 printf("The weight on the FSR is %f\n\n", fsr.readWeight());
cshao06 0:5521da8243b8 12 wait(0.3); //just here to slow down the output for easier reading
cshao06 0:5521da8243b8 13 }
cshao06 0:5521da8243b8 14 }