Código para utilizar e implementar el motor paso a paso

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
michjpr
Date:
Thu Nov 18 03:31:49 2021 +0000
Commit message:
Motor paso a paso

Changed in this revision

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 d7bcf5828371 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 18 03:31:49 2021 +0000
@@ -0,0 +1,18 @@
+#include "mbed.h"
+BusOut motor(PA_4,PA_5,PA_6,PA_7);
+int tiempo = 10000;//tiempo en us (tiempo entre pasos) nos da la velocidad 
+int main() {
+    while(1) {
+        for (int s = 0; s < 512 ; s +=1) {//el 120 indica 120*4 pasos, en mi motor de 48 pasos 10 vueltas
+        motor = (0xA); //1010
+        wait_us(tiempo);
+        motor = (0x6);//0110
+        wait_us(tiempo);
+        motor = (0x5);//0101
+        wait_us(tiempo);
+        motor = (0x9);//1001
+        wait_us(tiempo);
+        }
+        wait(2);
+   }
+}
\ No newline at end of file
diff -r 000000000000 -r d7bcf5828371 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 18 03:31:49 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file