Grupo 4 2020-1 / Mbed 2 deprecated Classe_LCD

Dependencies:   mbed TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 #include "Joystick.h"
00004 #include "Telas.h"
00005 
00006 Joystick Joy (A2, A3, USER_BUTTON); // VRX, VRY, SW
00007 
00008 
00009 
00010 
00011 int main() {
00012     LCD_Init();
00013     Tela_0();
00014     
00015     int row = 0;
00016     int col = 0;
00017     while(1){
00018         switch (Joy.ler_x()) // Rotina para movimentar eixo X
00019         {
00020             case 0: 
00021                 if (row == 0){ row = 0; } else{ row--;}
00022                 lcd.locate(col,row);
00023                 wait(0.2); 
00024                 break;
00025             case 1: 
00026                 if (row == 3){ row = 3; } else{ row++;}
00027                 lcd.locate(col,row);
00028                 wait(0.2); 
00029                 break;
00030         }
00031         if (Joy.bot_select() == 0){
00032             switch (row){
00033                 case 0: Tela_1(); break;
00034                 case 1: Tela_2(); break;
00035                 case 2: Tela_3(); break;
00036                 case 3: Tela_4(); break;
00037             }
00038         }
00039 
00040     }
00041 
00042 //// Create custom characters
00043 //    const char udc_I1[]   = {0x0A, 0x1F, 0x0E, 0x04, 0x00, 0x00, 0x00, 0x00};
00044 //    
00045 //// Set custom char to address 0
00046 //    lcd.setUDC(0, (char *) udc_I1);
00047 //    
00048 //// Go to col=3 row=0
00049 //    lcd.locate(3,0);
00050 //    
00051 //// Print the custom char
00052 //    lcd.putc(0);  
00053 
00054 }