![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
control simple de motor paso a paso unipolar
main.cpp
- Committer:
- lorzangas
- Date:
- 2012-10-22
- Revision:
- 0:414bd7c6b901
- Child:
- 1:26c2fd1ea036
File content as of revision 0:414bd7c6b901:
#include "mbed.h" BusOut myleds(LED1, LED2, LED3, LED4); BusOut motor(p10, p11, p12, p13); /* Step C0 C1 C2 C3 1 1 0 1 0 2 0 1 1 0 3 0 1 0 1 4 1 0 0 1 */ int tiempo = 12000; int main() { while(1) { for (int s = 0; s < 120 ; s +=1) { motor = (0xA); wait_us(tiempo); motor = (0x6); wait_us(tiempo); motor = (0x5); wait_us(tiempo); motor = (0x9); wait_us(tiempo); } wait(2); for (int s = 0; s < 120 ; s +=1) { motor = (0x9); wait_us(tiempo); motor = (0x5); wait_us(tiempo); motor = (0x6); wait_us(tiempo); motor = (0xA); wait_us(tiempo); } wait(2); } }