50_135_507_38_Insper
/
Menu_IHM
IHM com 4 botões e todas as telas de pontos
Fork of Menu_IHM by
Revision 12:ccf601fd7e49, committed 2018-05-18
- Comitter:
- digo1234
- Date:
- Fri May 18 18:18:30 2018 +0000
- Parent:
- 11:0cc3113c9ca8
- Commit message:
- ihm pre integra??o;
Changed in this revision
teste.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/teste.cpp Tue May 15 17:21:18 2018 +0000 +++ b/teste.cpp Fri May 18 18:18:30 2018 +0000 @@ -22,21 +22,68 @@ TextLCD_I2C lcd(&i2c_lcd, 0x7E, TextLCD::LCD20x4); // I2C exp: I2C bus, PCF8574 Slaveaddress, LCD Type int menu=0; -float x=420.69, y=420.69, z=420.69; +float x=1.0, y=2.0, z=3.0; +int inicial= 1; +int pisca =0; +float i=0.0; + +Ticker flipper; +void contagem() + {i++;} int main() { + + lcd.setBacklight(TextLCD::LightOn); lcd.setCursor(TextLCD::CurOff_BlkOff); + while (inicial==1) + { + lcd.setCursor(TextLCD::CurOff_BlkOff); + lcd.setAddress(0,0); + lcd.printf("INICIANDO PROGRAMA!"); + if(pisca==0) + { + lcd.setAddress(0,2); + lcd.printf("Aguarde***"); + pisca=1; + wait(0.2); + } + if(pisca==1) + { + lcd.setAddress(0,2); + lcd.printf("Aguarde.**"); + pisca=2; + wait(0.2); + } + if(pisca==2) + { + lcd.setAddress(0,2); + lcd.printf("Aguarde..*"); + pisca=3; + wait(0.2); + } + if(pisca==3) + { + lcd.setAddress(0,2); + lcd.printf("Aguarde..."); + pisca=0; + wait(0.2); + } + //printf("dentro do menurodando programa\r\n"); + wait(5); + inicial=0; + } + lcd.cls(); - while(1){ + while(inicial==0){ if (menu<0){ menu=0; printf("menu %d \r\n",menu); } - /*if (menu>){ + /*if (menu==){ menu=6; printf("menu %d \r\n",menu); }*/ @@ -114,7 +161,7 @@ if(button2==apertado) {menu=1;} if(button3==apertado) - {menu=1;} + {menu=0;} if(button4==apertado) {menu=6;} } @@ -227,18 +274,64 @@ {menu=1;} } lcd.cls(); - if ((menu==7)&& (button1==solto) && (button2==solto) && (button3==solto) && (button4==solto)){ + i=0; + flipper.attach(&contagem,0.2); + while ((menu==7)&& (button1==solto) && (button2==solto) && (button3==solto) && (button4 == solto) && (i< 100.0)){ + if((x>0 or y>0 or z>0 or x<0 or y<0 or z<0)) + { lcd.setCursor(TextLCD::CurOff_BlkOff); lcd.setAddress(0,0); lcd.printf("RODANDO PROGRAMA!"); - lcd.setAddress(0,2); - lcd.printf("Aguarde..."); + // lcd.setAddress(0,2); + //lcd.printf("Aguarde..."); printf("dentro do menurodando programa\r\n"); - wait(5); + + if(pisca==0) + { + lcd.setAddress(0,2); + lcd.printf("Aguarde "); + pisca=1; + wait(0.5); + } + if(pisca==1) + { + lcd.setAddress(0,2); + lcd.printf("Aguarde. "); + pisca=2; + wait(0.5); + } + if(pisca==2) + { + lcd.setAddress(0,2); + lcd.printf("Aguarde.. "); + pisca=3; + wait(0.5); + } + if(pisca==3) + { + lcd.setAddress(0,2); + lcd.printf("Aguarde..."); + pisca=0; + wait(0.5); + } + //wait(5); + // menu=0; + } + if(x==0 or y==0 or z==0 ) + { + lcd.setCursor(TextLCD::CurOff_BlkOff); + lcd.setAddress(0,0); + lcd.printf("NAO TEM PONTO SALVOS"); + lcd.setAddress(0,2); + //lcd.printf("Aguarde..."); + // printf("dentro do menurodando programa\r\n"); + // wait(3); menu=0; + } } lcd.cls(); - + i=0; + flipper.detach(); } }