lcd

Dependencies:   Keypad mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD_20X4.h"
00003 #include "Keypad.h"
00004 
00005 Keypad kpad(D0,D1,D2,D3,D4,D5,D6,D7);
00006 TextLCD_20X4 lcd(PTC7,PTC0,PTC3,PTC4,PTC5,PTC6,PTC10,PTC11); // rs, e, d0, d1, d2, d3
00007   
00008 int main() {
00009     char key;
00010     int tecla=0;  
00011     lcd.cls();
00012     lcd.locate(0,0);
00013     lcd.printf("bienvenido ");  
00014    wait_ms(2000);
00015      
00016     while(1) {      
00017        
00018       // lcd.cls(); 
00019        lcd.locate(0,0);
00020        lcd.printf(" digite la presion ");
00021      
00022        key=kpad.ReadKey();//Lectura del teclado
00023        tecla=key-48;
00024        if (tecla==1){
00025          lcd.cls();
00026          lcd.locate(1,1);
00027          lcd.printf("20 psi ");
00028          }
00029          
00030          if(tecla==2){
00031          lcd.cls();   
00032          lcd.locate(0,1);
00033          lcd.printf("40 psi ");             
00034          }
00035         
00036          if(tecla==3){
00037              
00038          lcd.cls();
00039          lcd.locate(0,1);
00040          lcd.printf("60 psi");                      
00041             }
00042          if(key=='4'){
00043          lcd.cls();    
00044          lcd.locate(0,1);
00045          lcd.printf("80 psi");   
00046          
00047          }          
00048          }
00049          }
00050