
Código para o menu no LCD
Dependencies: mbed SDFileSystemSD TextLCD
Fork of TextLCD_HelloWorld2 by
Diff: main.cpp
- Revision:
- 32:c293f89170b0
- Parent:
- 31:77eb51d4ee18
- Child:
- 33:0149960e95c1
--- a/main.cpp Tue May 22 18:49:32 2018 +0000 +++ b/main.cpp Wed May 23 14:54:13 2018 +0000 @@ -6,6 +6,8 @@ #include "string" #include "vector" +Timer timer; + // Host PC Communication channels Serial pc(USBTX, USBRX); // tx, rx //não apagar @@ -34,6 +36,9 @@ int salvar = 0; int maxpontos = 5; int home; +int coluna = 1; +int contador = 0; +int sair = 0; //variáveis float float cx = 120.458; @@ -45,13 +50,10 @@ //funções interrupt void botenter_press(void); -void botenter_solto(void); +void botcima_press(void); +void botbaixo_press(void); +void botenter_release(void); -void botcima_press(void); -void botcima_solto(void); - -void botbaixo_press(void); -void botbaixo_solto(void); #include "classes.h" @@ -68,6 +70,8 @@ botao_enter.fall(&botenter_press); //chama função botao enter botao_cima.fall(&botcima_press); //chama função botao para cima botao_baixo.fall(&botbaixo_press); //chama função bota para baixo + botao_enter.rise(&botenter_release); //chama função ler timer + while(1){ switch(menu.func){ //faz com que as telas sejam iniciadas @@ -89,27 +93,40 @@ case 18: menu.ctzhome(); break; case 19: menu.origem(); break; case 20: menu.nomeprog(); break; + case 21: menu.mudar_nome(); break; } } } //função interrupt botão enter void botenter_press(void){ - penter = bot_enter; - bot_enter = !bot_enter; - printf("%d, %d, enter high\n\r", penter, bot_enter); - } + penter = bot_enter; + bot_enter = !bot_enter; + printf("enter high, timer reset FALL\n\r"); + timer.reset(); + timer.start(); + } //função interrupt botão cima void botcima_press(void){ - pcima = bot_cima; - bot_cima = !bot_cima; - printf("cima high\n\r"); - } + pcima = bot_cima; + bot_cima = !bot_cima; + 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\n\r"); - } \ No newline at end of file + pbaixo = bot_baixo; + bot_baixo = !bot_baixo; + printf("baixo high\n\r"); + } + +//função para ler o timer + void botenter_release(void){ + timer.stop(); + float t = timer.read(); + if (t>=2.0){ + sair = 1; + } + printf("%f,%d, time stop RISE\n\r", t, sair); + } \ No newline at end of file