|
Re: [FTC]: Programming a TETRIX Encoder - Wheel Problem
Hi Charging Champions!
I would recommend a function like the one below to use encoders.
void forward( int rotations, int power ){
motor[motor1] = 0;
motor[motor2] = 0;
//Resets the motor encoder readings.
while( nMotorEncoder[motor1] < rotations ){
motor[motor1] = power;
motor[motor2] = power;
}//goes forward until one of the two sides has rotated enough
}
Be sure to remember that it takes a lot of rotations to travel any distance at all!
Good Luck!
|