Hi!
My team mate and I are trying to make a program(in RobotC) that will allow for the encoders to return the speeds of each of the four after the robot he ball goes through, so that we can change the speed of the other motors briefly until we can get it back up to speed, then we want it to set back to full power. After trying it, the robot’s motors kept slowing down. I don’t know why this is happening, and any ideas or help would be much appreciated! Below is my code:
if(fire==true) //fire is set to a boolean so that we don’t have to hold down the button in the competition
{
int left1 = 127;
int left2 = 127;
int right1 = 127;
int right2 = 127;
motor[leftShoot] = left1;
motor[rightShoot] = right1;
motor[leftShoot2] = left2;
motor[rightShoot2] = right2;
if(nMotorEncoder[leftShoot]< nMotorEncoder[leftShoot2])
{
left2–;
}
if(nMotorEncoder[leftShoot]> nMotorEncoder[leftShoot2])
{
left1–;
}
if(nMotorEncoder[rightShoot]< nMotorEncoder[rightShoot2])
{
right2–;
}
if(nMotorEncoder[rightShoot]> nMotorEncoder[rightShoot2])
{
right1–;
}
}