Projeto Mecatrônico
/
ProjetoMecatronico
testando
Diff: main_PM.cpp
- Revision:
- 20:81a44a25b21d
- Parent:
- 19:ebe198368444
- Child:
- 22:dd336b95db5d
- Child:
- 23:1c74f54c9d4a
--- a/main_PM.cpp Mon May 25 22:44:05 2020 +0000 +++ b/main_PM.cpp Mon May 25 22:59:39 2020 +0000 @@ -1,9 +1,10 @@ +//local para inclusão de bibliotecas #include "mbed.h" #include "TextLCD.h" #include "Keypad.h" //local para a declaração de variáveis -float t_motor = 0.003; +float t_motor = 0.002; float t_teclado = 0.01; int hor[] = {12,6,3,9}; int antihor[] = {3,6,12,9}; @@ -12,14 +13,15 @@ float coord_x = 0; float coord_y = 0; float coord_z = 0; +int est_x = 0; +int est_y = 0; +int est_z = 0; //pinos usados pelos botões de fim de curso DigitalIn fdc_x(PC_10); DigitalIn fdc_y(PC_11); DigitalIn fdc_z(PC_12); -int est_x = 0; -int est_y = 0; -int est_z = 0; + //botões para movimentação eixo a eixo DigitalIn x_mais(PA_0); DigitalIn x_menos(PA_1); @@ -43,6 +45,9 @@ BusOut eixoz(PC_9,PC_8,PB_8,PC_6); int main() { + printf("\n%i",est_x); + printf("\n%i",est_y); + printf("\n%i",est_z); lcd.printf("Bem-vindo ao Pipemax"); lcd.locate(0,1); lcd.printf("o seu sistema"); @@ -53,6 +58,9 @@ while (fdc_x != 0){for(int i = 0; i < 4; i++){eixox = hor[i];wait(t_motor);est_x = 1;}} while (fdc_y != 0){for(int i = 0; i < 4; i++){eixoy = hor[i];wait(t_motor);est_y = 1;}} while (fdc_z != 0){for(int i = 0; i < 4; i++){eixoz = hor[i];wait(t_motor);est_z = 1;}} + printf("\n%i",est_x); + printf("\n%i",est_y); + printf("\n%i",est_z); while(1) { int solta = 1; tecla = teclado.ReadKey(); //read the current key pressed