Script voor aansturen motoren

Dependencies:   Encoder HIDScope MODSERIAL mbed-dsp mbed

Revision:
10:a2a2e7bfdc86
Parent:
9:18e7a0273106
Child:
11:ba0a33e6ff0d
--- a/main.cpp	Mon Oct 27 19:32:52 2014 +0000
+++ b/main.cpp	Tue Oct 28 00:11:24 2014 +0000
@@ -40,13 +40,13 @@
 
 void looper()
 {
-    motordir1=0;
-    pwm_motor1.write(1);
+    /*motordir1=0;
+    pwm_motor1.write(0.06);
     scope.set(0, motor1.getPosition());
     scope.set(1, motor1.getSpeed());
     scope.set(2, motor2.getPosition());
-    scope.set(3, motor2.getPosition());
-    scope.send();
+    scope.set(3, motor2.getSpeed());
+    scope.send();*/
 }
 
 /*void clamp(float * in, float min, float max)
@@ -68,18 +68,22 @@
 }*/
 
 int main()
-{
-    /*motordir1=0;
+{   
+    wait(1);
     pwm_motor1.period_us(100);
-    pwm_motor1.write(1);
-    wait(0.034);
+    motordir1=0;
+    pwm_motor1.write(0.7);
+    wait(0.78);
     pwm_motor1.write(0);
     wait(1);
     motordir1=1;
-    pwm_motor1.write(1);
-    wait(0.034);
-    pwm_motor1.write(0);*/
-
+    pwm_motor1.write(0.7);
+    wait(0.78);
+    pwm_motor1.write(0);
+    wait(1);
+    motordir1=1;
+    
+    
 
     Ticker log_timer;
     Ticker timer;
@@ -89,6 +93,6 @@
     pc.baud(115200);
     while(1) {
         wait(0.2);
-        pc.printf("pos: %d, speed %f \r\n", motor1.getPosition(), motor1.getSpeed());
+        pc.printf("%d, %f \r\n", motor1.getPosition(), motor1.getSpeed());
     }
 }