
Código para o menu no LCD
Dependencies: mbed SDFileSystemSD TextLCD
Fork of TextLCD_HelloWorld2 by
Revision 30:614dcbd74cdc, committed 2018-05-22
- Comitter:
- claraluques
- Date:
- Tue May 22 13:58:18 2018 +0000
- Parent:
- 29:558eccdfc079
- Child:
- 31:77eb51d4ee18
- Commit message:
- vou testar fazer o bot?o pull up, salvando por garantia
Changed in this revision
classes.h | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/classes.h Mon May 21 19:45:56 2018 +0000 +++ b/classes.h Tue May 22 13:58:18 2018 +0000 @@ -433,13 +433,13 @@ wait(1); - status = sdcard.get_file_names(); + /*status = sdcard.get_file_names(); if(status){ printf("Filenames: \n\r"); for(int i = 0; i < filenames.size(); i++){ printf("%s\n\r", filenames[i]); } - } + }*/ wait(1); func = 1; @@ -799,7 +799,7 @@ void salvarprog(){ lcd.cls(); bot_enter = 0; - lcd.printf("Voce deseja salvar este programa?"); + lcd.printf("Voce deseja salvar este programa?"); lcd.locate(5,2); lcd.printf("Sim"); lcd.locate(5,3); @@ -808,11 +808,12 @@ if (bot_enter!=penter){ if (linha==2){ salvar = 1; - func = 7; + printf("salvar\n\r"); + //func = 20; } if (linha==3){ salvar = 0; - func = 7; + //func = 7; } } } @@ -845,6 +846,54 @@ func = 4; } + //func 20 + void nomeprog(){ + lcd.cls(); + bot_enter = 0; + lcd.printf("oieeee"); + printf("tela\n\r"); + escrever(3); + if (bot_enter!=penter){ + func = 1; + } + } + + //função para escrever nome arquivo + void escrever(int coluna){ + char alfabeto[38] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z', + '0','1','2','3','4','5','6','7','8','9','-','_'}; + /*string alfabeto = "abcdefghijklmnopqrstuvwxyz0123456789-_";*/ + int imax = 37; + 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){ + i--; + } + bot_cima = 0; + } + else if (bot_baixo == 1){ + if (i==imax){ + i = imin; + } + else if (i<imax && i>=imin){ + i++; + } + bot_baixo = 0; + } + // } + lcd.locate(coluna, 1); + lcd.printf("%c", alfabeto[i]); + //lcd.printf("oi"); + } + } + //função para ler os pontos void readSerial(){ char recv;
--- a/main.cpp Mon May 21 19:45:56 2018 +0000 +++ b/main.cpp Tue May 22 13:58:18 2018 +0000 @@ -88,6 +88,7 @@ case 17: menu.salvarprog(); break; case 18: menu.ctzhome(); break; case 19: menu.origem(); break; + case 20: menu.nomeprog(); break; } } } @@ -96,19 +97,19 @@ void botenter_press(void){ penter = bot_enter; bot_enter = !bot_enter; - //printf("enter high\n\r"); + printf("enter high\n\r"); } //função interrupt botão cima void botcima_press(void){ pcima = bot_cima; bot_cima = !bot_cima; - //printf("cima high"); + printf("cima high\n\r"); } //função interrupt botão baixo void botbaixo_press(void){ pbaixo = bot_baixo; bot_baixo = !bot_baixo; - //printf("baixo high"); + printf("baixo high\n\r"); } \ No newline at end of file