Movimento do eixo Z

Dependencies:   mbed

Revision:
18:1374daf4e6a3
Parent:
17:f3a45eeb1a7e
--- a/JOG_EIXO_Z.cpp	Wed May 19 17:00:31 2021 +0000
+++ b/JOG_EIXO_Z.cpp	Wed May 19 17:03:46 2021 +0000
@@ -6,6 +6,7 @@
 AnalogIn eixo_Z(PC_2);
 InterruptIn posicao_salva(PA_15);
 InterruptIn botao_emergencia(PC_4);
+DigitalIn botao_indicador_fonte_externa(PC_10);
 
 BusOut motor_z(PB_1, PB_15, PB_14, PB_13);
 
@@ -19,6 +20,7 @@
 int passo_fuso = 5;
 int pegaZ;
 int posicao_salva_estado, botao_emergencia_estado;
+int fonte_externa;
 
 void rotina_posicao_salva(void);
 void rotina_emergencia(void);
@@ -41,11 +43,13 @@
         J_Z = eixo_Z.read_u16();
         posicao_salva_estado = posicao_salva.read();
         botao_emergencia_estado = botao_emergencia.read();
+        fonte_externa = botao_indicador_fonte_externa.read();
 
         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);
 
-        rotida_aciona_motor();
-
+        if(fonte_externa == 1) {
+            rotida_aciona_motor();
+        }
     }
 }