Weird pros problem

This is our ez template code we got from the ez pto tutorial

( PTO Tutorial | EZ Template)

we configured the ports and button stuff and for our op control, we just put


pros::Motor& intake_l = chassis.left_motors[-4];
pros::Motor& indexer = chassis.right_motors[14];
pros::ADIDigitalOut transmission ('A');
bool pto_intake_enabled = false;

void pto_intake(bool toggle) {
  pto_intake_enabled = toggle;
  chassis.pto_toggle({intake_l, indexer}, toggle);
  if (toggle) {

void set_intake(int input) {
  if (!pto_intake_enabled) return;
  intake_l = input;
  indexer = input;

int button_lock = 0;
void intake_control() {
  if (master.get_digital(DIGITAL_L1) && button_lock == 0) {
    button_lock = 1;
  } else if (!master.get_digital(DIGITAL_L2)) {
    button_lock = 0;

  if (master.get_digital(DIGITAL_X))
  else if (master.get_digital(DIGITAL_B))

when i press button L1 to enable the pto, it gives this weird output and the robot stops driving

In your first lines of code, within the square brackets you input the ports instead of the index. The motors are stored in a vector, so the number you put in the square brackets is the place in the vector the motor is.

If your drive constructure looks like this

Drive chassis (
  // Left Chassis Ports (negative port will reverse it!)
  //   the first port is the sensored port (when trackers are not used!)
  {1, 2, -4}

  // Right Chassis Ports (negative port will reverse it!)
  //   the first port is the sensored port (when trackers are not used!)
  ,{5, 14, 6}

  // IMU Port

  // Wheel Diameter (Remember, 4" wheels are actually 4.125!)

  // Cartridge RPM

  // External Gear Ratio (MUST BE DECIMAL)
  // eg. if your drive is 84:36 where the 36t is powered, your RATIO would be 2.333.
  // eg. if your drive is 36:60 where the 60t is powered, your RATIO would be 0.6.

Then the index for your intake motor is chassis.left_motors[2] and for the indexer is chassis.right_motors[1]. These start counting from 0.

The second issue is the tutorial is wrong on something that we haven’t fixed yet. Instead of creating the motors with

pros::Motor& intake_l = chassis.left_motors[2];
pros::Motor& indexer = chassis.right_motors[1];

and using intake_l and indexer throughout the code, call chassis.left_motors[2] and chassis.right_motors[1] directly.

The tutorial fails at making both of these things more clear, this is one of the most common questions I get about the pto stuff. Thanks for reminding me about this as 3.0 is coming out at some point, we’ll make sure this is fixed with that release. Let me know if this fixed the problem!


yo thanks so much that worked

1 Like