smd.iotkit1.ch / Mbed 2 deprecated Motor_DigitalOut

Dependencies:   Motor mbed

Fork of Motor by smd.iotkit1.ch

Revision:
0:6d98ef70e4b9
Child:
1:cd92955f8d4b
diff -r 000000000000 -r 6d98ef70e4b9 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 23 17:13:17 2015 +0000
@@ -0,0 +1,32 @@
+/** Motor Beispiel
+*/
+#include "mbed.h"
+#include "Motor.h"
+
+Motor m1(D3, D2, D4); // PWM, Vorwaerts, Rueckwarts
+
+int main() 
+{
+    printf( "Motor Test\n" );
+    while   ( 1 )
+    {
+        // rueckwaerts
+        printf( "rueckwaerts\n" );
+        for (double s= 0.5; s < 1.0 ; s += 0.01) 
+        {
+           m1.speed(s * -1); 
+           wait(0.4);
+        }
+        m1.speed( 0 );
+        wait( 1.0 );
+        
+        printf( "vorwaerts\n" );        
+        for (double s= 0.5; s < 1.0 ; s += 0.01) 
+        {
+           m1.speed(s); 
+           wait(0.4);
+        }
+        m1.speed( 0 );
+        wait( 1.0 );   
+    }
+}
\ No newline at end of file