Fernando Sakabe / Mbed 2 deprecated motor_passo

Dependencies:   mbed buzzer

Files at this revision

API Documentation at this revision

Comitter:
fernandosakabe
Date:
Mon Apr 25 22:25:13 2022 +0000
Commit message:
j

Changed in this revision

buzzer.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 4cd724eebb78 buzzer.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buzzer.lib	Mon Apr 25 22:25:13 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/Reniboy/code/buzzer/#622b1d533a1c
diff -r 000000000000 -r 4cd724eebb78 main.cpp
--- /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
diff -r 000000000000 -r 4cd724eebb78 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Apr 25 22:25:13 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file