Using analog signal to control 6 motors for 2 different purposes?

Hi everyone! I’m new to both VEX and ROBOTC and I’ve got no idea if I’d posted this thread in the correct channel…

Anyway, let me talk about my problem. I’m now trying to build a robot that can grab small objects, like a cup of water, for me from tables or benches. Right now, I’ve done most of the physical construction of it but facing a coding problem: I want to have both the arm on the robot and the tank treads at the base to be controlled using analog signal.

We all know that there are only two joysticks on the joystick controller and, by default, if I want to use them for one, I have to use the buttons to control the other.

My idea is I can control the treads when I’m using joysticks and when I manipulate joysticks while I’m holding an extra button the signal corresponds to the arm, but the problem is I’m not sure if it is practical and have no idea how to do this. Is there any other easier method to achieve my goal?

BTW, there’re 2 motors on either side of the base ( 4 in total) . As for the arm, there are two movable parts, one motor for each and a claw is mounted at the front of the arm.

Here are some pictures of my robot.


If I understand correctly, you want to use the joystick for the treads, but use them for the arm when a button is pressed.

In that case, here’s some pseudocode:

task main()
{
  while (true)
  {
    while(button is not pressed (equal to 0))
    {
      tank tread code
    }
    while(button is pressed (equal to 1))
    {
      arm code
    }
  }
}

Or

task main()
{
  while(true)
  {
    if(button is pressed)
    {
       arm code
    }
    if(button is not pressed)
    {
      tank tread code
    }
  }
}

WOW! Wasn’t expecting such a quick and detailed answer!

I’ll try this tomorrow.

Thanks for helping me : )

An alternative would be to have the robot drive be arcade control which controls the drive entirely from one joystick. This would then free the other joystick for the arm and claw.

You could do

while (true)//make a loop set to run forever
{
While (vexRT[btn7U] == 1)//while the button is pressed
{
Lift control code
}
While (vexRT[btn7U != 1)//while the button is not pressed
{
Drive control code
}
}

anyway, hope this helps at least a little bit. :slight_smile: