Biorobotics / Mbed 2 deprecated Motor_moving_setpoint

Dependencies:   QEI mbed

Files at this revision

API Documentation at this revision

Comitter:
yohoo15
Date:
Mon Sep 28 14:13:31 2015 +0000
Parent:
1:c855dee2c6d4
Commit message:
Hij doet raar, doet twee dingen door elkaar; ;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Sep 28 12:33:24 2015 +0000
+++ b/main.cpp	Mon Sep 28 14:13:31 2015 +0000
@@ -15,11 +15,12 @@
 
 
 Ticker tellen;
+
 volatile bool stoppen = false;
 
 void GOTO()
 {
-    double Offset = 10511 ;//8400 counts is aangegeven op de motor ( is te weinig) 10511 schiet iets over
+double Offset = 10341 ;//8400 counts is aangegeven op de motor ( is te weinig) 10511 schiet iets over
 double resolution = Offset / (2 * 3.14159265);
 double Rotation = 4; // rotation in pi
 double movement = Rotation * resolution;
@@ -34,7 +35,7 @@
         } else {
             PWM.write(0);
             //pc.printf("The motor turned %i rotations \n",Rotation);
-            pc.printf("Pulses is: %i\n The motor turned %.2f rotations\n", wheel.getPulses(),Rotation);
+            pc.printf("Pulses is: %i\n The motor turned %.2f  pi rotations\n", wheel.getPulses(),wheel.getPulses()/resolution);
             stoppen = true;
         
 
@@ -50,21 +51,31 @@
 int main()
 
 {
-   int proberen = 1000;
-       pc.printf("The number of rotation is %i \n",proberen);
-   
+   int proberenn = 1000;
+       pc.printf("The number of rotation is %i \n",proberenn);
        
+      while(1){
+    if(stoppen == false){ // doet eerst de while loop en dan begint hij met de ticker
+            tellen.attach(&GOTO, 0.1); 
+              pc.printf("dit is if \n");
+        stoppen = true;
+            } else
+            {
+       
+           pc.printf("wees geen bitch \n");
+           
+           }
+           
+         }
+}
+
+          
    
    
-    while(stoppen == false){
-           tellen.attach(&GOTO, 0.1); 
-           }
-           
-          
                 
 
         
     
        
 
-}
+