Shaft Encoders, where to get started?

I’m from team 4221C (excuse the username) and we are having trouble figuring out where to get started in terms of Shaft Encoders. We are trying to use them to travel a set distance in Autonomous.

We are using Mecanum wheels in direct drive, so no gears for drive.
We are running EasyC v4.2.1.7.

Thanks, in advance.

I don’t know EasyC but some EasyC’ers have told me this is a good place to start:

https://www.youtube.com/watch?v=sJ9Ym04C1Dk

https://www.youtube.com/watch?v=B4xJzc8eu6g

Hook them up and initialize them in the program. Preset them to zero. Next, add a “while loop,” and in it, place a “get encoder” block. Then place a “wait” block in the loop (have the robot wait a few seconds). Finally, place a “print to screen” block at the end of the loop and have it print to screen the variable for the encoder. You can use the help tab to get the right variable type for the “print to screen” block. Build the program and download it to the cortex.

With the cortex attached to the computer, download the program. Still attached, place the robot at the start of a tape measure. Manually move the robot the desired distance. Then, record the final value (the one that continuously pops up after you stop moving the robot). That position is the encoder value for that distance.

This procedure works with Shaft encoders and Integrated Motor Encoders, and probably with potentiometers as well.

Hope that this helps.

        -nxtmonkeys

:cool:

Just be aware that potentiometers (pots) have a range of motion limited to about 0 to 250 degrees (never a full turn or multiple turns), and you do not need to “zero” them. Their output is absolute.