<p>A good way to do this is to use a control algorithm with feedback to control the position of the second motor. You can research &quot;PID&quot; to learn how to make your own.</p>
<p>Or if you want an out-of-the-box experience, there is a PID block from HiTechnic available that does this. It can be downloaded from <a href="https://modernroboticsinc.com/downloads/" rel="nofollow noreferrer">here</a> (search for &quot;PID&quot;). There is also a <a href="https://www.youtube.com/watch?v=d0bghBZZMUg" rel="nofollow noreferrer">YouTube video</a> showing how the block works.</p>

CC BY-SA 4.0
2022-05-13T11:39:52.090Z
That's great! I didn't know you could program your own blocks. Is there a guide on how to create them?
algiogia
CC BY-SA 4.0
2022-05-13T15:50:54.663Z
This sounds like a great question that others might be interested in. So you should ask it as a new question rather than in the comments. :-)
David Lechner
CC BY-SA 4.0
2022-05-12T14:40:19.897Z
2022-05-12T14:40:19.897Z
David Lechner
<p>I'm trying to make a program in NXT 2.0 that mirrors the (manual) movements of one motor to another.</p>
<p>I managed to start motor B running in the right direction but I am having trouble controlling the number of degrees. I tried using the <code>degree</code> output of the sensor as input for the motor but it doesn't work: the B motor moves a bit but not the same amount of motor A.</p>
<p><a href="https://i.sstatic.net/c16FY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/c16FY.png" alt="enter image description here" /></a></p>
<p>So I tried with a loop instead: rotate motor B until its position is equal to motor A.</p>
<p><a href="https://i.sstatic.net/xWT2v.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xWT2v.png" alt="enter image description here" /></a></p>
<p>The second solution works slightly better but is still not precise.</p>
<p>Any suggestions?</p>

CC BY-SA 4.0
2022-05-10T11:31:24.420Z
@user253751 doesn't look like it's possible. I can only set the amount of degrees,  rotations or time
algiogia
CC BY-SA 4.0
2022-05-10T12:37:38.883Z
@user253751 it (should) rotates of the given degrees from the current position
algiogia
CC BY-SA 4.0
2022-05-10T14:56:41.120Z
@user253751 I've tried that already. I'm passing the value to the motor but it doesn't move the right amount.
algiogia
<mindstorms><nxt><motor><sensor>
NXT - Mirror motor rotation
algiogia
# NXT - Mirror motor rotation

(Asked by: username_0 on 2022-05-10)

I'm trying to make a program in NXT 2.0 that mirrors the (manual) movements of one motor to another.

I managed to start motor B running in the right direction but I am having trouble controlling the number of degrees. I tried using the `degree` output of the sensor as input for the motor but it doesn't work: the B motor moves a bit but not the same amount of motor A.

[![enter image description here](https://i.sstatic.net/c16FY.png)](https://i.sstatic.net/c16FY.png)

So I tried with a loop instead: rotate motor B until its position is equal to motor A.

[![enter image description here](https://i.sstatic.net/xWT2v.png)](https://i.sstatic.net/xWT2v.png)

The second solution works slightly better but is still not precise.

Any suggestions?

**Tags:** mindstorms, nxt, motor, sensor

> **Comments:**
> **username_0**: @user253751 doesn't look like it's possible. I can only set the amount of degrees,  rotations or time  
> **username_0**: @user253751 it (should) rotates of the given degrees from the current position  
> **username_0**: @user253751 I've tried that already. I'm passing the value to the motor but it doesn't move the right amount.  

---

## 1 answers

### Answer by username_1 on 2022-05-12. Score: 2 | Accepted answer

A good way to do this is to use a control algorithm with feedback to control the position of the second motor. You can research "PID" to learn how to make your own.

Or if you want an out-of-the-box experience, there is a PID block from HiTechnic available that does this. It can be downloaded from [here](https://modernroboticsinc.com/downloads/) (search for "PID"). There is also a [YouTube video](https://www.youtube.com/watch?v=d0bghBZZMUg) showing how the block works.

> **Comments:**
> **username_0**: That's great! I didn't know you could program your own blocks. Is there a guide on how to create them?  
> **username_1**: This sounds like a great question that others might be interested in. So you should ask it as a new question rather than in the comments. :-)  

---

