lcd

Dependencies:   Keypad mbed

main.cpp

Committer:
crizz777
Date:
2018-10-03
Revision:
0:33c425e06a2c

File content as of revision 0:33c425e06a2c:

#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");   
         
         }          
         }
         }