lorzangas porafor
/
motorpaso
control simple de motor paso a paso unipolar
Revision 0:414bd7c6b901, committed 2012-10-22
- Comitter:
- lorzangas
- Date:
- Mon Oct 22 04:47:24 2012 +0000
- Child:
- 1:26c2fd1ea036
- Commit message:
- Simple control 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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 22 04:47:24 2012 +0000 @@ -0,0 +1,38 @@ +#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); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Oct 22 04:47:24 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/cd19af002ccc \ No newline at end of file