The example program for mbed pin-compatible platforms

Dependencies:   mbed TextLCD

Files at this revision

API Documentation at this revision

Comitter:
rougoubossj
Date:
Thu Jun 03 14:13:09 2021 +0000
Parent:
24:7f14b70fc9ef
Commit message:
systeme_JIN_JOJOJOJO

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Thu Jun 03 14:13:09 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- a/main.cpp	Mon Apr 08 11:03:25 2019 +0100
+++ b/main.cpp	Thu Jun 03 14:13:09 2021 +0000
@@ -1,12 +1,78 @@
 #include "mbed.h"
+#include "TextLCD.h"
+DigitalOut myled(LED1);
+
+DigitalIn first(PA_8);
+DigitalIn second(PB_10);
 
-DigitalOut myled(LED1);
+AnalogIn PA0(PA_0);
+AnalogIn PA4(PA_4);
+
+Serial pc(SERIAL_TX,SERIAL_RX);
+
+void affiche_temperature();
+void affiche_pression();
+
+TextLCD lcd(PC_7, PA_7, PA_6, PA_5, PB_9, PB_8);
+
 
 int main() {
-    while(1) {
-        myled = 1;
-        wait(0.2);
-        myled = 0;
-        wait(0.2);
-    }
+     
+     
+     lcd.printf(" Hello World! \n");
+     wait(2);
+     lcd.cls(); 
+     while(1){
+         if ((first==1)&&(second==0))     affiche_temperature();  
+         //if(first==1) ;
+         else if ((first==0)&&(second==1))   affiche_pression(); 
+         else  
+            {
+                lcd.printf("which value u want to know");
+                wait(1); 
+                lcd.cls(); 
+                lcd.printf("1. Temperature\n2. Pression\n");
+                wait(1); 
+                lcd.cls(); 
+                lcd.printf("3.vitesse\n4.direction\n");
+                wait(1); 
+                lcd.cls(); 
+            }
+     }
+         
+         
+
+
 }
+
+
+void affiche_temperature(){
+
+        float value_tem = 0.0;
+        float temperature = 0.0;
+        value_tem = PA0.read();
+  //      lcd.printf("\n \r value_tem = %f", value_tem);
+ 
+        
+        temperature = ((value_tem*3.3f + 0.7815f )/0.01f)- 273.15f;
+        lcd.printf(" T= %.2f C\n", temperature);
+        
+        wait(2); 
+        lcd.cls();  
+    
+}
+
+void affiche_pression(){
+        float value_pre = 0.0;
+        float pression = 0.0;
+        value_pre = PA4.read();
+//      lcd.printf("\n \r  value_pre= %f", value_pre);
+    
+        
+        pression  = (((value_pre *3.3f + 0.0902f)/3.3f ) + 0.095f) / 0.009f;
+        lcd.printf(" P = %.2f kPa", pression);
+        
+        wait(3); 
+        lcd.cls();  
+    
+}
\ No newline at end of file