Wessel Klumperman / Mbed 2 deprecated Inverse_kinematics

Dependencies:   Encoder HIDScope MODSERIAL mbed

Fork of Inverse_kinematics by Casper Kroon

Files at this revision

API Documentation at this revision

Comitter:
CasperK
Date:
Wed Oct 17 10:12:06 2018 +0000
Parent:
1:fc216448bb57
Child:
3:56cbed6caacc
Commit message:
Still with "qualifiers dropped" error

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Oct 17 10:09:28 2018 +0000
+++ b/main.cpp	Wed Oct 17 10:12:06 2018 +0000
@@ -46,17 +46,19 @@
 
 void yDirection (int &motor2_angle) {      
     if (emg2) {
-        //calculating the motion
-        y_position++;
-        motor2_angle = C2 * y_position;
-        
         //direction of the motion
         if (y_direction) {
             directionpin2 = true;
+            direction = 1;
         }
         else if (!y_direction) {
             directionpin2 = false;
+            direction = -1;
         }
+        
+        //calculating the motion
+        y_position = y_position + direction;
+        motor2_angle = C2 * y_position;
     }
 }