Projeto Mecatrônico
/
LCD_IHM
LCD
Diff: IHM.cpp
- Revision:
- 4:cdd205f48898
- Parent:
- 3:8e11b49b1b29
- Child:
- 5:5e0059e59cb2
--- a/IHM.cpp Tue May 18 19:18:07 2021 +0000 +++ b/IHM.cpp Wed May 19 15:49:51 2021 +0000 @@ -1,15 +1,13 @@ #include "mbed.h" #include "TextLCD.h" +TextLCD lcd(D8, D9, D4, D5, D6, D7); // rs, e, d4-d7 Serial pc (USBTX, USBRX); - -TextLCD lcd(D8, D9, D4, D5, D6, D7); -AnalogIn eixo_Z(A0); +AnalogIn eixo_Z(PC_2); InterruptIn posicao_salva(PA_15); -InterruptIn botao_emergencia(PB_10); +InterruptIn botao_emergencia(PC_4); BusOut motor_z(PB_1, PB_15, PB_14, PB_13); - float tempo_horario, tempo_anti_horario; //Segundos int pulsos_horario, pulsos_anti_horario; int i; @@ -35,6 +33,8 @@ motor_z = 0x00; posicao_salva.rise(&rotina_posicao_salva); botao_emergencia.rise(&rotina_emergencia); + lcd.locate(0,0); + lcd.printf("Posicao Z:"); while(1) { @@ -44,10 +44,9 @@ pc.printf("Z=%4d, PegaZ=%4d, Posicao_salva_estado=%d, Botao_emergencia_estado=%d, Tempo1=%4f, Tempo2=%4f, Pulsos=%d, Deslocamento_Z=%f, Velocidade_Z=%f\r\n", J_Z, pegaZ, posicao_salva_estado, botao_emergencia_estado, tempo_horario, tempo_anti_horario, pulsos_anti_horario, deslocamento_total_Z, velocidade_Z); - lcd.locate(0,0); - lcd.printf("Posicao Z:"); + lcd.locate(0,1); - lcd.printf("%fmm",deslocamento_total_Z); + lcd.printf("%4fmm",deslocamento_total_Z); if(31000 <= J_Z & J_Z <= 35000) { @@ -78,9 +77,9 @@ } } } - - wait_ms(100); - lcd.cls(); + + //wait_ms(100); + //lcd.cls(); } }