Project Paint / Mbed 2 deprecated arm_control

Dependencies:   mbed QEI biquadFilter

Revision:
0:494acf21d3bc
Child:
2:fc869e45e672
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/controller.cpp	Mon Oct 31 13:05:53 2016 +0000
@@ -0,0 +1,30 @@
+#include "controller.h"
+
+bool constantMovementTo(Arm arm, float length) {
+    const float velocity = 2;
+    float initialLength = arm.getLength();
+    float dLength = length-initialLength;
+    
+    if (dLength < 0) {
+        velocity = -1 * velocity;
+        arm.setVelocity(velocity);
+        while (dLength < 0) {
+            // Wait
+        }
+        arm.setVelocity(0);
+        return true;
+    } else {
+        arm.setVelocity(velocity);
+        while (dLength > 0) {
+            // Wait
+        }
+        arm.setVelocity(0);
+        return true;
+    }
+}
+
+
+
+
+
+