50_135_507_38_Insper
/
Menu_IHM
IHM com 4 botões e todas as telas de pontos
Fork of Menu_IHM by
Diff: teste.cpp
- Revision:
- 10:1c4ab7bc50b7
- Parent:
- 9:d9148b367fd9
- Child:
- 11:0cc3113c9ca8
--- a/teste.cpp Wed May 09 18:22:34 2018 +0000 +++ b/teste.cpp Wed May 09 22:05:03 2018 +0000 @@ -1,17 +1,15 @@ -/* Hello World! for the TextLCD Enhanced Library*/ #include "mbed.h" #include "TextLCD.h" #define apertado 0 #define solto 1 - -//#include "TextLCDScroll.h" - + + DigitalIn button1(D5); DigitalIn button2(D4); DigitalIn button3(D6); DigitalIn button4(D7); - + DigitalOut led(LED2); // Host PC Communication channels @@ -19,30 +17,16 @@ // I2C Communication I2C i2c_lcd(D14,D15); // SDA, SCL - - + + TextLCD_I2C lcd(&i2c_lcd, 0x7E, TextLCD::LCD20x4); // I2C exp: I2C bus, PCF8574 Slaveaddress, LCD Type - -bool previous1=0, previous2=0; + int menu=0; float x=420.69, y=420.69, z=420.69; - -void aumenta_menu(){ - menu = menu + 1; - //printf("menu %d \r\n",menu); - -} - -void diminui_menu() -{ - menu = menu - 1; - // printf("menu %d \r\n",menu); - -} int main() { - + //button1.fall(&aumenta_menu); //button2.fall(&diminui_menu); @@ -63,8 +47,6 @@ while ((menu==0)&& (button1==solto) && (button2==solto) && (button3==solto) && (button4==solto)){ lcd.setAddress(3,0); lcd.printf("MENU PRINCIPAL"); - //lcd.setAddress(0,1); - //lcd.printf("SELECIONE UMA FUNCAO "); lcd.setAddress(0,2); lcd.printf("1-SALVAR PONTOS"); lcd.setAddress(0,3); @@ -136,8 +118,8 @@ {menu-=1;} if(button3==apertado) {menu=1;} - // if(button4==apertado) - //{menu=0;} + if(button4==apertado) + {menu=6;} } lcd.cls(); while ((menu==3)&& (button1==solto) && (button2==solto) && (button3==solto) && (button4==solto)){ @@ -251,4 +233,4 @@ } } - \ No newline at end of file + \ No newline at end of file