
Werkt
Dependencies: Encoder HIDScope MODSERIAL QEI mbed
Fork of Inverse_kinematics_PIDController by
Diff: main.cpp
- Revision:
- 2:ffd0553701d3
- Parent:
- 1:fc216448bb57
- Child:
- 3:56cbed6caacc
--- 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; } }