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'](https://i.stack.imgur.com/ebils.png) 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.

[![Current code implementation - click for larger](https://i.stack.imgur.com/ebils.png)](https://i.stack.imgur.com/ebils.png)