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.
main.cpp
00001 #include "mbed.h" 00002 #include "flow.h" 00003 #include "TextLCD.h" 00004 00005 Serial ttl(PA_0, PA_1); 00006 PwmOut led(PB_6); 00007 TextLCD lcd(PC_8,PC_6,PB_15,PB_14,PB_13,PB_12, TextLCD::LCD16x2); 00008 00009 00010 int main() 00011 { 00012 00013 flow(); 00014 ttl.baud(9600); 00015 00016 lcd.cls(); 00017 wait(0.001); 00018 lcd.locate(3,0); 00019 lcd.printf("|"); 00020 lcd.locate(4,0); 00021 lcd.printf("|"); 00022 00023 00024 while(1) { 00025 00026 lcd.locate(8,0); 00027 lcd.printf("f: %f\n", finalflow); 00028 00029 //ttl.printf("flow: %f\n", finalflow); 00030 if (flow()<0.4) 00031 { 00032 lcd.locate(0,1); 00033 lcd.printf("* "); 00034 led.write(0.00f); 00035 } 00036 if (flow()>=0.4 and flow()<1.5) 00037 { 00038 lcd.locate(0,1); 00039 lcd.printf("** "); 00040 led.write(0.20f); 00041 } 00042 if (flow()>=1.5 and flow()<2.7) 00043 { 00044 lcd.locate(0,1); 00045 lcd.printf("*** "); 00046 led.write(0.40f); 00047 } 00048 if (flow()>=2.7 and flow()<3) 00049 { 00050 lcd.locate(0,1); 00051 lcd.printf("**** "); 00052 led.write(0.60f); 00053 } 00054 if (flow()>=3 and flow()<3.3) 00055 { 00056 lcd.locate(0,1); 00057 lcd.printf("***** "); 00058 led.write(0.80f); 00059 } 00060 if (flow()>=3.3) 00061 { 00062 lcd.locate(0,1); 00063 lcd.printf("******"); 00064 led.write(1.00f); 00065 } 00066 // lcd.printf("%f\n", flow()); 00067 wait (0.2); 00068 00069 } 00070 }
Generated on Thu Jul 21 2022 22:08:02 by
1.7.2