I belive you should be using something like this:
#include "main.h"
// Motor definitions
pros::Motor_Group motors_left(1);
pros::Motor_Group motors_right(2);
void opcontrol() {
while(1) {
// Retrieve the necessary joystick values
int leftY = master.get_analog(pros::E_E_CONTROLLER_ANALOG_LEFT_Y);
int rightX = master.get_analog(pros::E_E_CONTROLLER_ANALOG_RIGHT_X);
// Move the left side of the robot
motors_left.move(leftY + rightX);
// Move the right side of the robot
motors_right.move(leftY - rightX);
delay(20);
}
}
It looks like you are only using the ‘ANALOG_RIGHT_X’, and according to the code from this PROS website, you should be using both left and right. The second problem is that the value passed in to Controller.get_analog(); is “ANALOG_DIRECTION_X” when it should look something like ‘pros::E_E_CONTROLLER_ANALOG_DIRECTION_Y’ or ‘pros::E_CONTROLLER_ANALOG_DIRECTION_Y’
There is also some helpful code on PROS arcade drive in this thread.