lcd

Dependencies:   Keypad mbed

Revision:
0:33c425e06a2c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 03 00:42:11 2018 +0000
@@ -0,0 +1,50 @@
+#include "mbed.h"
+#include "TextLCD_20X4.h"
+#include "Keypad.h"
+
+Keypad kpad(D0,D1,D2,D3,D4,D5,D6,D7);
+TextLCD_20X4 lcd(PTC7,PTC0,PTC3,PTC4,PTC5,PTC6,PTC10,PTC11); // rs, e, d0, d1, d2, d3
+  
+int main() {
+    char key;
+    int tecla=0;  
+    lcd.cls();
+    lcd.locate(0,0);
+    lcd.printf("bienvenido ");  
+   wait_ms(2000);
+     
+    while(1) {      
+       
+      // lcd.cls(); 
+       lcd.locate(0,0);
+       lcd.printf(" digite la presion ");
+     
+       key=kpad.ReadKey();//Lectura del teclado
+       tecla=key-48;
+       if (tecla==1){
+         lcd.cls();
+         lcd.locate(1,1);
+         lcd.printf("20 psi ");
+         }
+         
+         if(tecla==2){
+         lcd.cls();   
+         lcd.locate(0,1);
+         lcd.printf("40 psi ");             
+         }
+        
+         if(tecla==3){
+             
+         lcd.cls();
+         lcd.locate(0,1);
+         lcd.printf("60 psi");                      
+            }
+         if(key=='4'){
+         lcd.cls();    
+         lcd.locate(0,1);
+         lcd.printf("80 psi");   
+         
+         }          
+         }
+         }
+