AND / Mbed 2 deprecated FeNO_LCD

Dependencies:   mbed TextLCD

Revision:
1:fd5a598caa32
Parent:
0:a13b440d4fd1
Child:
2:bcf033cefa0e
--- a/main.cpp	Thu May 23 08:09:19 2019 +0000
+++ b/main.cpp	Thu May 23 14:39:11 2019 +0000
@@ -1,15 +1,70 @@
 #include "mbed.h"
-AnalogIn ain(A3);
+#include "flow.h"
+#include "TextLCD.h"
+
 Serial ttl(PA_0, PA_1);
+PwmOut led(PB_6);
+TextLCD lcd(PC_8,PC_6,PB_15,PB_14,PB_13,PB_12, TextLCD::LCD16x2);
+
 
 int main()
 {  
 
+    flow();
     ttl.baud(9600);
-    float x=0;
+    
+    lcd.cls();
+    wait(0.001);
+    lcd.locate(3,0);
+    lcd.printf("|");
+    lcd.locate(4,0);
+    lcd.printf("|");
+    
     
     while(1) {
-        x=3.3*ain; //Logic level 3.3
-        ttl.printf("%f\n", x);
+     
+     lcd.locate(8,0);
+    lcd.printf("f: %f\n", finalflow);
+     
+        //ttl.printf("flow: %f\n", finalflow);
+        if (flow()<0.4)
+        {
+            lcd.locate(0,1);
+            lcd.printf("*     ");
+            led.write(0.00f);
+        }
+        if (flow()>=0.4 and flow()<1.5)
+        {
+            lcd.locate(0,1);
+            lcd.printf("**    ");
+            led.write(0.20f);
+        }
+        if (flow()>=1.5 and flow()<2.7)
+        {
+            lcd.locate(0,1);
+            lcd.printf("***   ");
+            led.write(0.40f);
+        }
+        if (flow()>=2.7 and flow()<3)
+        {
+            lcd.locate(0,1);
+            lcd.printf("****  ");
+            led.write(0.60f);
+        }
+        if (flow()>=3 and flow()<3.3)
+        {
+            lcd.locate(0,1);
+            lcd.printf("***** ");
+            led.write(0.80f);
+        }
+        if (flow()>=3.3)
+        {
+            lcd.locate(0,1);
+            lcd.printf("******");
+            led.write(1.00f);
+        }
+   // lcd.printf("%f\n", flow());
+    wait (0.2);
+                
     }
 }