I’m trying to program my controller in the same way that it would be in a video game (left stick is forward/ back and right stick is for turning left/ right). I’ve set up my code so that channel 3 makes the robot go forward/ back and channel 1 makes the robot turn left/ right while also being connected to the same 2 motors.
task main ()
{
while(1 == 1)
{
motor[leftMotor] = - vexRT[Ch3]; // forward and back
motor[rightMotor] = - vexRT[Ch3]; // forward and back
motor[rightMotor] = vexRT[Ch1]; // left and right
motor[leftMotor] = - vexRT[Ch1]; // left and right
if(vexRT[Btn8R] == 1) //If button 8L is pressed...
{
motor[backMotor] = 127; //...move wheel left.
}
else if(vexRT[Btn8L] == 1) //Else, if button 8R is pressed...
{
motor[backMotor] = - 127; //...move wheel right.
}
else //Else (neither button is pressed)...
{
motor[backMotor] = 0; //...stops wheel.
}
if(vexRT[Btn5U] == 1) //If button 5U is pressed...
{
motor[handMotor] = 127; //...raise the hand.
}
else if(vexRT[Btn5D] == 1) //Else, if button 5D is pressed...
{
motor[handMotor] = - 127; //...lower the hand.
}
else //Else (neither button is pressed)...
{
motor[handMotor] = 0; //...stop the hand.
}
if(vexRT[Btn6U] == 1) //If button 6U is pressed...
{
motor[armMotors] = 127; //...raise the arm.
}
else if(vexRT[Btn6D] == 1) //Else, if button 6D is pressed...
{
motor[armMotors] = - 127; //...lower the arm.
}
else //Else (neither button is pressed)...
{
motor[armMotors] = 0; //...stop the arm.
}
}
}
My robot has no trouble turning left and right (Ch1) but for some reason whenever I try making it go forward or back (Ch3) the motors seem weaker and doesn’t move the robot at all. I’ve switched the channels to see if there was something wrong with the controller but even then it still doesn’t work. I think it’s because I have 2 different channels connected to same motors and that’s causing the trouble. Is there some way that I can get passed this problem in the coding or programming?