Chenkai Shao / Mbed 2 deprecated FSR_hello_world

Dependencies:   FSR mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "FSR.h"
00003 
00004 FSR fsr(p20, 10); // Pin 20 is used as the AnalogIn pin and a 10k resistor is used as a voltage divider
00005 
00006 int main(){
00007     while (1)
00008     {
00009         printf("The raw data is %f\n", fsr.readRaw());
00010         printf("The resistance of the FSR is %f\n", fsr.readFSRResistance());
00011         printf("The weight on the FSR is %f\n\n", fsr.readWeight());
00012         wait(0.3); //just here to slow down the output for easier reading
00013     }
00014 }