Michael Goyeneche
/
MotorPasoAPaso
Código para utilizar e implementar el motor paso a paso
Diff: main.cpp
- Revision:
- 0:d7bcf5828371
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