![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Código para o menu no LCD
Dependencies: mbed SDFileSystemSD TextLCD
Fork of TextLCD_HelloWorld2 by
Diff: classes.h
- Revision:
- 31:77eb51d4ee18
- Parent:
- 30:614dcbd74cdc
- Child:
- 32:c293f89170b0
--- a/classes.h Tue May 22 13:58:18 2018 +0000 +++ b/classes.h Tue May 22 18:49:32 2018 +0000 @@ -299,7 +299,7 @@ lcd.locate(col,min); lcd.printf("%c", 0x3E); while (bot_enter==penter){ - if (bot_cima==1){ + if (bot_cima==0){ if (linha==min){ lcd.locate(col,min); lcd.printf(" "); @@ -314,9 +314,9 @@ lcd.locate(col, linha); lcd.printf("%c", 0x3E); } - bot_cima = 0; + bot_cima = 1; } - else if (bot_baixo==1){ + else if (bot_baixo==0){ if (linha==max){ lcd.locate(col,max); lcd.printf(" "); @@ -331,10 +331,10 @@ lcd.locate(col, linha); lcd.printf("%c", 0x3E); } - bot_baixo = 0; + bot_baixo = 1; } //função para printar as coordenadas nas telas 2 e 8 - else if (func==2 || func==8){ + /*else if (func==2 || func==8){ //x if (cx<=-1 && cx>=-9){ lcd.locate(2,1); @@ -413,7 +413,7 @@ } //até aqui, para alinhar os números if (Mach.readable()){ readSerial(); - } + }*/ } } @@ -447,7 +447,7 @@ //func 1 void menuprincipal(){ //função menu principal - bot_enter = 0; + bot_enter = penter; lcd.cls(); lcd.locate(1,0); lcd.printf("Modo JOG"); @@ -476,11 +476,11 @@ //func 2 void jog(){ //função tela jog - bot_enter = 0; + lcd.cls(); + bot_enter = penter; machine.kill_jog(); wait(0.1); machine.jog(); - lcd.cls(); lcd.locate(4,0); lcd.printf("Coordenadas:"); lcd.locate(0,1); @@ -498,7 +498,7 @@ movercursor(1,3,10); if (bot_enter!=penter){ if (linha==1){ - if (pontos==0 && maxpontos>=1){ + /*if (pontos==0 && maxpontos>=1){ cx_salva = 0; cy_salva = 0; cz_salva = 0; @@ -510,13 +510,13 @@ cx_salva = cx; cy_salva = cy; cz_salva = cz; - pontos++; + */pontos++; maxpontos--; - func = 5; + func = 5;/* } else if (maxpontos==0){ func = 16; - } + }*/ } else if (linha==2) { machine.kill_jog(); @@ -535,7 +535,7 @@ //func 3 void automatico(){ //tela modo automatico lcd.cls(); - bot_enter = 0; + bot_enter = penter; lcd.printf("Modo automatico"); lcd.locate(7,2); lcd.printf("OK"); @@ -555,7 +555,7 @@ //func 4 void config() { lcd.cls(); - bot_enter = 0; + bot_enter = penter; //printf("%d,tela\n\r", penter); lcd.locate(1,0); lcd.printf("Definir velocidade"); @@ -612,7 +612,7 @@ //func 6 void telacola(){ //tela para escolher o tipo de sequencia da cola lcd.cls(); - bot_enter = 0; + bot_enter = penter; lcd.printf("P/ o proximo ponto:"); lcd.locate(3,1); lcd.printf("Sem cola"); @@ -641,7 +641,7 @@ //func 7 void executarprograma() { //tela para selecionar se deseja executar o programa lcd.cls(); - bot_enter = 0; + bot_enter = penter; lcd.locate(2,0); lcd.printf("VOCE CONCLUIU SEU"); lcd.locate(5,1); @@ -673,7 +673,7 @@ //func 8 void telazerar(){ //tela para zerar a máquina lcd.cls(); - bot_enter = 0; + bot_enter = penter; machine.kill_jog(); machine.jog(); lcd.locate(2,0); @@ -798,7 +798,7 @@ //func 17 void salvarprog(){ lcd.cls(); - bot_enter = 0; + bot_enter = penter; lcd.printf("Voce deseja salvar este programa?"); lcd.locate(5,2); lcd.printf("Sim"); @@ -809,11 +809,11 @@ if (linha==2){ salvar = 1; printf("salvar\n\r"); - //func = 20; + func = 20; } if (linha==3){ salvar = 0; - //func = 7; + func = 7; } } } @@ -821,7 +821,7 @@ //func 18 void ctzhome(){ lcd.cls(); - bot_enter = 0; + bot_enter = penter; lcd.printf("Certifique-se de que a maquina pode se"); lcd.locate(5,2); lcd.printf("movimentar"); @@ -849,7 +849,7 @@ //func 20 void nomeprog(){ lcd.cls(); - bot_enter = 0; + bot_enter = penter; lcd.printf("oieeee"); printf("tela\n\r"); escrever(3); @@ -867,27 +867,26 @@ int imin = 0; int i = 0; printf("entrou\n\r"); - //while (){ - while (bot_enter==penter){ - if (bot_cima == 1){ - if (i==imin){ - i = imax; - } - else if (i>imin && i<=imax){ + while (bot_enter==penter){ + if (bot_cima == 0){ + if (i==imin){ + i = imax; + } + else if (i>imin && i<=imax){ i--; - } - bot_cima = 0; } - else if (bot_baixo == 1){ - if (i==imax){ - i = imin; - } - else if (i<imax && i>=imin){ - i++; - } - bot_baixo = 0; - } - // } + bot_cima = 1; + } + else if (bot_baixo == 0){ + if (i==imax){ + i = imin; + } + else if (i<imax && i>=imin){ + i++; + } + bot_baixo = 1; + } + lcd.locate(coluna, 1); lcd.printf("%c", alfabeto[i]); //lcd.printf("oi");