Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- christodoulos
- Date:
- 2020-06-06
- Revision:
- 1:00fe5bf692b4
- Parent:
- 0:d034cdad5b6d
File content as of revision 1:00fe5bf692b4:
#include "mbed.h"
Serial ttl(PC_12,PD_2);
AnalogIn flowIn(PA_1);
float flowVal1;
float flowVal2;
float Pressure;
float finalflow;
float flow(){
flowVal1=3.3*flowIn; //Logic level 3.3
flowVal2 = 1.5*flowVal1; //5v
Pressure =(125*flowVal2)-62.5;
//finalflow=(0.3425*sqrt(Pressure))-0.198; //flow in litter per min
//finalflow= (-6.12e-5)*(Pressure)*(Pressure) + (2.98e-2)*Pressure - 8.83e-2;
return Pressure;
}
int main(){
ttl.baud(115200);
ttl.printf("$");//enter command mode only for rn
wait(0.1);
ttl.printf("$$");//enter command mode
wait(0.5);
ttl.printf("SN,Flow Calibration\r");//set new name
wait(0.5);
ttl.printf("SS,C0\r");//set transparent uart
wait(0.5);
ttl.printf("---\r");//enter data mode
wait(0.5);
while(1){
ttl.printf("%f\n", flow());
wait(0.1);
}
}