Counting ticks from a V5 motor encoder

This year my school just got the V5 system so I’m trying to make an encoder tick counter for a function to make it more accurate. I figured out how to make it reset the count and how to count it with the Motor.rotation command, however I want to display it on the screen as a double. How would I do this?

Look at the documentation, or research on this forum.
There is a way to print text to the screen in the API.
If you are stuck, come back telling us what you have tried and what does not work for you.

2 Likes

Brain brain;
vex::motor Motor = vex::motor(vex::PORT1);

int main()
{

while (true)
{
double ticks = Motor.rotation(vex::rotationUnits::(deg or rev);
Brain.Screen.print(ticks);
}
}

this will keep on printing ticks so i recommend you insert something like “this_thread::yield;” but i do not know if this is available in VCS.

I also do not recommend VCS and i think you should switch to VEXcode or PROS. VEXcode it basically the same and in C++ aswell. PROS, on the other hand, you can do C++ and C and do a lot more complex things with PROS. If you are just starting to code I suggest you use VEXcode. :slight_smile:

2 Likes

you need to read motor rotation inside the while loop for it to be updated.

1 Like

Thanks man I just fixed it m. Enjoy :slight_smile: