Projet_BMC
/
FSR
FSR
main.cpp
- Committer:
- the_nabil
- Date:
- 2020-01-23
- Revision:
- 6:ad77671aac31
File content as of revision 6:ad77671aac31:
#include "mbed.h" #include "FSR.h" #include "USBSerial.h" #include "math.h" //Virtual serial port over USB USBSerial serial; AnalogIn analog_value(A0); float F ; float P; float V ; int main(){ float meas; while (1) { meas = analog_value.read(); //V= meas*5; V= meas*3.3; P = 9146.3*(pow(V,3))-47648*(pow(V,2))+103084*V-47228; F = P *0.00193/9.81; serial.printf("V_out = %f\n", V); if (P>0 ) { serial.printf("Pression_out = %f\n", P); serial.printf("KG= %f\n", F); } else { serial.printf("Pression_out = 0 \n"); serial.printf("KG= 0 \n"); } wait(0.5); //just here to slow down the output for easier reading } }