Yasushi TAUCHI / Mbed 2 deprecated SteppingMotor1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
yueee_yt
Date:
Sun Jul 03 10:39:38 2011 +0000
Commit message:

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	Sun Jul 03 10:39:38 2011 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+
+DigitalOut myled(LED1);
+DigitalOut step_a(p19);
+DigitalOut step_b(p20);
+
+Ticker timer1;
+
+void add_step(void) {
+    static int mode=0;
+    switch (mode) {
+        case 0 :
+            step_b=0;
+            step_a=1;
+            mode=1;
+            break;
+        case 1 :
+            step_a=1;
+            step_b=1;
+            mode=2;
+            break;
+        case 2:
+            step_a=0;
+            step_b=1;
+            mode=3;
+            break;
+        case 3:
+            step_a=0;
+            step_b=0;
+            mode=0;
+            break;
+    }
+    myled=!myled;
+}
+
+int main() {
+    timer1.attach(&add_step, 0.01);
+
+    while (1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Jul 03 10:39:38 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912