Reading Lego Motor Encoders


Do you have any sample code and/or instructions for reading the data off of the Lego NXT motor encoders?

Thanks so much!


Hi Amy,

In the Bricktronics arduino libraries we use the PJRC encoder library, which is rock-solid and very high-performance:

If you are using any of the Bricktronics hardware, you can just use the Bricktronics or Bricktronics Megashield arduino library to read the motor position from the encoders:

We also have some simple design docs that discuss motor position feedback using rotary encoders: (near the end of the page)

Let us know if you need any additional information.

1 Like