robotc controller/encoder

using robotc for cortex would it be possible to press a button on the vex controller have a motor begin turning and stop once an encoder reached a certain value (using the optical shaft encoder)? how would it be done if so?

Look into PID control loops

I found this using the search functions of the forum. Read the post:


Then ask questions, if needed.

Yesterday, there was a conversation wherein a 7th grade student asked for details about how to do something rather specific. The conversation went off the rails eventually, but before it did I offered my opinion (and I’m very opinionated) about what it takes to get something useful out of a forum, and what had gone wrong in how he asked.

I see you just joined. You may benefit from reading this:

This is not to say you’ve done anything wrong or offended anyone. Just that, overall, it’s best to come in prepared. It’s considered polite to read up first. If you really don’t have time to do that–you probably really do, but if you don’t–explain your haste, and tell the folks here what you’ve already done.

@bluedot28 - To answer your question, yes, you can do what you asked. Here is a link to sample code that you can use to try. Let us know if you have any issues.

@Pete the example I pointed to above, is a typical programming gem from @jpearman. It has the two advantages. If you ask a question about it, the author of the code is likely to be the one giving the answer. And, it is being served up by the forum server, so (for me at least) it comes up a lot faster than the old wiki pages.