Hello I’m Kahl, and I have been recently building a robot but I am having troubles programming. I am using robot c and have a vex edr robot. I am trying to use a integrated encoder but once again I have no clue how to program it. I have two encoders I am trying to program on a remote control program. What I am asking from you is if you could please let me see a sample program for my current situation. Thank you very much.
I do suggest that you’d do some research before making a post, the google search bar is very useful
A good website that helps me is: Optical Shaft Encoder (2-pack) - VEX Robotics
one rotation of the encoder is a value of 360
One thing that may be useful is by doing a PI loop for your robot with an encoder if you want to slow down as it reaches 8 rotations(For example, a drivetrain):
while(true){
motor[leftMotor]=-(SensorValue[Encoder]-2880); //2880 is the amount of degrees the wheel has to turn
motor[rightMotor]=-(SensorValue[Encoder]-2880);
}
Hopefully that makes sense :L
How would you program the encoder to a button?
What do you mean programming the encoder to a button? I need a little bit more information of what you are trying to do…