Chris_is_Me:
I couldn’t respond to the Tech Support Forum, so I created a thread here…
This is some code I wrote up in RobotC that might do what you want. I don’t have a robot available to test it with, but I don’t see anything wrong with it… :rolleyes:
Note: This was written for the PIC controller and old radio transmitters.
#pragma config(Motor, port1, leftMotor, tmotorNormal, openLoop)
#pragma config(Motor, port2, rightMotor, tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
//************************************//
// Arcade Drive //
// //
// This code *should* be an arcade //
// drive control that can drive up to //
// full speed. This was made for the //
// "old" VEX system - PIC controller //
// and radio control. //
// //
// -Andrew (RoboDesigners) //
// Programmer for VRC #2190 //
// [www.RoboDesigners.com](http://www.RoboDesigners.com) //
//************************************//
task main()
{
//Define X and Y variables
int joyX;
int joyY;
bIfiAutonomousMode = false; //Enable driver operation
while(true)
{
//Puts meaningful values in the X and Y variables
joyX = vexRT[Ch1];
joyY = vexRT[Ch2];
if (joyY > 0) //If the joystick is right of the Y axis
{
motor[leftMotor] = joyY; //Left motor power is directly tied to the Y axis
/*This is the "hard" line - the right motor's power is a percent (found based
on the X position of the joystick) of the Y axis */
motor[rightMotor] = ((127 - joyX) / 127) * joyY;
}
else
{
if (joyX < 0) //If the joystick is left of the Y axis
{
//This block of code is the reverse of the above block
motor[rightMotor] = joyY;
motor[leftMotor] = ((127 + joyX) / 127) * joyY;
}
else //If the joystick is centered in the Y axis
{
//Both motors go same speed, tied to Y axis
motor[leftMotor] = joyY;
motor[rightMotor] = joyY;
}
}
}
}