Fernando Sakabe / Mbed 2 deprecated motor_passo

Dependencies:   mbed buzzer

Revision:
0:4cd724eebb78
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Apr 25 22:25:13 2022 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "buzzer.h"
+
+DigitalOut Fase_A(D4);
+DigitalOut Fase_B(D5);
+DigitalOut Fase_C(D6);
+DigitalOut Fase_D(D7);
+Beep Buzzer(D11);
+DigitalIn button(USER_BUTTON);
+
+int main()
+{
+    float tempo = 0.05;
+    int i = 0;
+    float time = 1.00;
+    float nota_do = 264.00;
+    int numero_fases = 4;
+    int datasheet_numero_passos = 200;
+    int numero_revolucoes = 2;
+    int revolucao = datasheet_numero_passos/numero_fases;
+    Fase_A = 0;
+    Fase_B = 0;
+    Fase_C = 0;
+    Fase_D = 0;
+    while(1) {
+        if(button == 0) {
+            while(i < numero_revolucoes * revolucao) {
+                Fase_A = 1;
+                wait(tempo);
+                Fase_A=0;
+                Fase_B=1;
+                wait(tempo);
+                Fase_B=0;
+                Fase_C=1;
+                wait(tempo);
+                Fase_C=0;
+                Fase_D=1;
+                wait(tempo);
+                Fase_D=0;
+                i++;
+            }
+            i = 0;
+            Buzzer.beep(nota_do, time);
+        }
+    }
+}
\ No newline at end of file