Driver Control not functioning. [PROS]

Hiya, I’m trying to switch over to PROS, and my Driver control isn’t working, well… more specifically, the tank controls aren’t working. Here’s the code:


void setDrive(int left, int right) { //Sets base motors power.
	motorSet(MOTOR_LEFT_1, left); //Sets front-left motor forward power.
	motorSet(MOTOR_LEFT_2, left); //Sets back-left motor forward power.
	motorSet(MOTOR_RIGHT_1, -right); //Sets front-right motor reverse power.
	motorSet(MOTOR_RIGHT_2, -right); //Sets back-right motor reverse power.


while(true) { //Beginning of driver control loop.

		setDrive(JSleft, JSright);


/////////////////////////// DRIVE MOTORS ////////////////////////////////////////
#define MOTOR_LEFT_1	2 //Sets front-left motor to port 2.
#define MOTOR_LEFT_2	3 //Sets back-left motor to port 3.
#define MOTOR_RIGHT_1	4 //Sets front-right motor to port 4.
#define MOTOR_RIGHT_2	5 //Sets back-right motor to port 5.

To my logic, this should be working, no idea why it isn’t. Please and thanks!

Code looks fine, and the only thing you don’t include is the code that determines JSleft and JSright, so I’m wondering if the problem is there.

Try running driver control but instead of setting the motors to the joystick values, try just putting both sides to full speed and see if it runs. If it does, that means the issue lies with receiving/processing controller values.

int JSleft, JSright; //Declares 'JSleft' and 'JSright' variables used for Joystick Definitions.
JSleft = joystickGetAnalog(1, 3); //Sets 'left' variable to equal the value of the left joystick on channel 3.
JSright = joystickGetAnalog(1, 2); //Sets 'right' variable to equal the value of the right joystick on channel 2.

Whoops, thought I added that, here’s the code for the declarations.

So unless I’m missing something, what’s happening is that the only time you set the value of JSleft and JSright is during their first initialization, which is going to be 0 the first time. Since it doesn’t look like you update the values of JSleft and JSright in your driver control loop, you’re always passing the same value 0 to the setDrive method.

If you set JSleft and JSright equal to the joystick values inside of the while loop, it should fix your problem.