Unofficial Response to: "channel 4 values"

Original Thread

"So I’m trying to make a basic code that controls a 2 motor drive with just the left joystick, so I made this simple code.


#pragma config(Motor,  port1,           Lmotor,        tmotorVex393_HBridge, openLoop)
#pragma config(Motor,  port2,           Rmotor,        tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
{
	while (true){
		int leftpower = vexRT[Ch3] - vexRT[Ch4];
		int rightpower = vexRT[Ch3] + vexRT[Ch4];
		motor[port1] = leftpower;
		motor[port2] = rightpower;

	}
}

I don’t have my robot or controller with me, so I can’t test this, but I don’t know which direction I would have to push the joystick in order to get a positive value from channel 4. can someone tell me this?

Also, this is actually my first time with this software, so if these are any mistakes, please let me know."

Response:
Think of the Joysticks like axis’. Ch3 and Ch2 would be y-axis’ and Ch4 and Ch1 would be x-axis’. Whenever the controller is at the center, it is like (0, 0). As such, moving Ch4 to the right will give you a positive value and, using your code as reference, will make your drive turn left because you’re making the left side negative and the right side positive. If this is not what you wanted then just reverse the + and - to get the opposite effect.

I hope this answered your question and clarified any other thing that you needed to know about your code.