# Inverting motor's rotation

I've designed a robot with two motors. It works as follows:

The first motor is attached to the the person's arm, the second motor receives the calculated movement and moves accordingly.

When the person moves his hand (open/close) the other robot moves the the opposite direction; upon opening it closes and vise-versa.

I've tried to invert the movement by multiplying by -1 but the second motor keeps moving on his own. I've tried multiplying the results of both motors, before subtracting, with no success.

The 'code' does the following:

1. I take the movements of motors A and B
2. Subtract value of motor A from motor B's
3. Save the result to a variable-'moveDist'
4. Take the absolute value after subtraction for comparison
5. If greater than 6, pass 'moveDist' value to the second motor.

• Sorry, don't know how to post my code, here's a link: i.imgur.com/OR2uAMP.png Also I have a video demonstrating what happens to the hand after the multiplication(If you wanna see). Commented May 13, 2015 at 17:22
• I'm not at all well-versed in the spaghetticode that comes from LEGO's EV3 software, but conceptually, isn't the "take the absolute value" part unnecessary and even wrong? Shouldn't you be moving B the difference between A and B so that B' = B+ (A-B) = A ? Commented May 13, 2015 at 18:29
• That's why I used the variable 'moveDist', to save the B' value. The absolute value is used for comparison (A threshold), if I don't do so, the hand will keep on shaking. Commented May 14, 2015 at 10:23
• Ok I see that now - couple of more things: You need to clarify what the issue is: is it that movements seem to be mirrored but passing -1 * MoveDist does not seem to reverse the movement? or is it that `but the second motor keeps moving on his own.` - i.e. motor B keeps making movements even if motor A does not register any movement (or movements below your '6' threshold)? Commented May 14, 2015 at 11:27