testando

Dependencies:   mbed TextLCD2

Revision:
10:4f49e9859535
Child:
11:dc557e461dfd
Child:
13:257302e01c7c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main_PM.cpp	Sun May 24 21:11:08 2020 +0000
@@ -0,0 +1,88 @@
+#include "mbed.h"
+#include "TextLCD.h"
+#include "Keypad.h"
+
+//local para a declaração de pinos e variáveis
+float t_motor = 0.008;
+float t_teclado = 0.01;
+//botões para movimentação eixo a eixo
+DigitalIn x_mais(PA_0);
+DigitalIn x_menos(PA_1);
+DigitalIn y_mais(PC_0);
+DigitalIn y_menos(PC_1);
+DigitalIn z_mais(PC_2);
+DigitalIn z_menos(PC_3);
+
+//pinos da placa usados na biblioteca do LCD
+TextLCD lcd(D4, D5, D6, D7, D8, D9); 
+
+//pinos de saída para os motores
+//eixo x
+DigitalOut a1(PA_15);
+DigitalOut b1(PA_14);
+DigitalOut c1(PA_13);
+DigitalOut d1(PA_12);
+//eixo y
+DigitalOut a2(PA_11);
+DigitalOut b2(PA_10);
+DigitalOut c2(PB_2);
+DigitalOut d2(PB_1);
+//eixo z
+DigitalOut a3(PC_9);
+DigitalOut b3(PC_8);
+DigitalOut c3(PB_8);
+DigitalOut d3(PC_6);
+
+int main() {
+lcd.printf("    Bem-vindo   ");
+lcd.locate(0,1);
+lcd.printf("   ao Pipemax    ");
+lcd.locate(0,2);
+lcd.printf("o seu sistema automatizado");
+lcd.locate(0,3);
+lcd.printf("    de pipetagem");
+while(1) {
+    if (x_mais == 0){
+        a1 = 1;b1 = 1;wait(t_motor);
+        a1 = 0;c1 = 1;wait(t_motor);
+        b1 = 0;d1 = 1;wait(t_motor);
+        c1 = 0;a1 = 1;wait(t_motor);
+        d1 = 0;a1 = 0;
+        }
+    if (x_menos == 0){
+        d1 = 1;c1 = 1;wait(t_motor);
+        d1 = 0;b1 = 1;wait(t_motor);
+        c1 = 0;a1 = 1;wait(t_motor);
+        b1 = 0;d1 = 1;wait(t_motor);
+        a1 = 0;d1 = 0;
+        }
+    if (y_mais == 0){
+        a2 = 1;b2 = 1;wait(t_motor);
+        a2 = 0;c2 = 1; wait(t_motor);
+        b2 = 0;d2 = 1;wait(t_motor);
+        c2 = 0;a2 = 1;wait(t_motor);
+        d2 = 0;a2 = 0;
+        }
+    if (y_menos == 0){
+        d2 = 1;c2 = 1;wait(t_motor);
+        d2 = 0;b2 = 1;wait(t_motor);
+        c2 = 0;a2 = 1;wait(t_motor);
+        b2 = 0;d2 = 1;wait(t_motor);
+        a2 = 0;d2 = 0;
+        }
+    if (z_mais == 0){
+        a3 = 1;b3 = 1;wait(t_motor);
+        a3 = 0;c3 = 1;wait(t_motor);
+        b3 = 0;d3 = 1;wait(t_motor);
+        c3 = 0;a3 = 1;wait(t_motor);
+        d3 = 0;a3 = 0;
+        }
+    if (z_menos == 0){
+        d3 = 1;c3 = 1;wait(t_motor);
+        d3 = 0;b3 = 1;wait(t_motor);
+        c3 = 0;a3 = 1;wait(t_motor);
+        b3 = 0;d3 = 1;wait(t_motor);
+        a3 = 0;d3 = 0;
+        }
+}
+}