View unanswered posts | View active topics It is currently Sun Apr 20, 2014 2:28 pm






Reply to topic  [ 4 posts ] 
Running two controllers via the Partner Port 
Author Message
Rookie

Joined: Fri Sep 04, 2009 3:03 pm
Posts: 10
Post Running two controllers via the Partner Port
I am trying to program our robot for this year's VEX competitions and I can not find how to run both controllers. Basically I am looking to drive with the first controller and move an arm and hang with the second controller. Right now I have the code all done and working so that I can preform all the functions with one controller, but I can't figure out how to code in the second controller or how you would read the inputs from it. We have a competition in two weeks so it would be great if I could get this working very soon.


Thanks!

_________________
Jordan Miller
2010 Dean's List Semi-Finalist
FRC 1741 --- Engineering Captain, Driver
Vex 323a --- Team Captain, Driver


Thu Nov 11, 2010 6:24 pm
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 403
Post Re: Running two controllers via the Partner Port
Hi Jordan -

If you've got the hardware all configured correctly, accessing values from the 2nd controller is as easy as accessing it from the 1st. To access the value, use the keyword you would usually use, but append "Xmtr2" to the end of it.

For instance, if I wanted to access the value of the Down button in group 5, on the 2nd controller, I'd use "vexRt[Btn5DXmtr2]" instead of just "vexRT[Btn5D]".

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Mon Nov 15, 2010 12:55 pm
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 403
Post Re: Running two controllers via the Partner Port
In the sample program below, joystick values from Controller 1 are controlling the driving motors, and a button from Controller 2 is controlling an arm. Hope that helps!

Code:
#pragma config(Motor,  port2,           rightMotor,    tmotorNormal, openLoop, reversed)
#pragma config(Motor,  port3,           leftMotor,     tmotorNormal, openLoop)
#pragma config(Motor,  port6,           armMotor,      tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
  while(time1[T1] < 90000)
  {
    motor[leftMotor] = vexRT[Ch3];
    motor[rightMotor] = vexRT[Ch2];

    if(vexRT[Btn6UXmtr2] == 1)
    {
      motor[armMotor] = 40;
    }
    else if(vexRT[Btn6DXmtr2] == 1)
    {
      motor[armMotor] = -40;
    }
    else
    {
      motor[armMotor] = 0;
    }
  }
}

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Mon Nov 15, 2010 4:12 pm
Profile
Rookie

Joined: Fri Sep 04, 2009 3:03 pm
Posts: 10
Post Re: Running two controllers via the Partner Port
Thank you! I have got everything working now. =)

_________________
Jordan Miller
2010 Dean's List Semi-Finalist
FRC 1741 --- Engineering Captain, Driver
Vex 323a --- Team Captain, Driver


Mon Nov 15, 2010 6:58 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.