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.
pressure.h
00001 #include "mbed.h" 00002 00003 AnalogIn flowadc(PC_4); 00004 00005 float finalflow; 00006 float flowVal1; 00007 float flowVal2; 00008 float P1; 00009 int flag=0; 00010 int o=0; 00011 float bpArray[10]; 00012 float fp;float sp; 00013 float FPressure; 00014 00015 float pressure() 00016 { 00017 while(1) { 00018 wait(0.01); 00019 flowVal1=3.3*flowadc; //Logic level 3.3 00020 flowVal2 = 1.5*flowVal1; //5v 00021 P1 =(125*flowVal2)-62.5; 00022 if (flag==0){ 00023 bpArray[o]=P1; 00024 sp+=bpArray[o]; 00025 o=o+1; 00026 if (o=9) 00027 { 00028 fp=sp/10; 00029 flag=1; 00030 } 00031 } 00032 return P1; 00033 } 00034 } 00035 00036 float flow() 00037 { 00038 while(1) { 00039 if (flag ==0) 00040 { 00041 finalflow=0; 00042 } 00043 if (flag ==1) 00044 { 00045 FPressure=pressure()-fp; 00046 finalflow=(0.1989*sqrt(FPressure))+0.0284; //flow in litter per min 00047 return finalflow; 00048 } 00049 } 00050 } 00051
Generated on Sat Sep 10 2022 20:47:02 by
1.7.2