Samenwerking Groep 12

Dependencies:   Encoder MODSERIAL HIDScope mbed

Foo

Revision:
23:34e97668550f
Parent:
22:d22381fe3b16
Child:
24:465efbd884d5
--- a/main.cpp	Tue Sep 22 13:59:36 2015 +0000
+++ b/main.cpp	Tue Sep 22 14:31:54 2015 +0000
@@ -31,6 +31,7 @@
         double position=motor2.getPosition(); //current motor position
         double error=reference-position;
         pc.printf("ik doe het positie = %d en error =%d en reference=%d \r\n", position, error, reference);
+        scope.set(0,motor2.getPosition());
         return  P(error,motor2_Kp);
     }
 
@@ -54,17 +55,11 @@
         motor2speed=fabs(output_motor);
         motor2direction=0;
         break;}
-            while(1){
+            {
             pc.printf("else loop controller");
-            scope.set(0,motor2.getPosition());}
+            }
         }
     
-//  while (Error_position > 0) {
-//                motor2direction = 0;
-//                motor2speed=0.3f;}
-//            while (Error_position < 0) {
-//                motor2direction = 1;
-//                motor2speed=0.3f;}
 // Piece of code that keeps the value of the position between the counts per revolution
         while ((motor2.getPosition()>counts_per_revolution) || (motor2.getPosition()<-counts_per_revolution)) // If value is outside -4200 and 4200 (number of counts equal to one revolution) reset to zero
         {