No Instance of constructor "pros::v5::Motor::Motor" matches the argument list

whenever I try to make my drivetrain motors, the port always gets underlined in red and i get an error saying “no instance of constructor “pros::v5::Motor::Motor” matches the argument list” “argument types are: (int, pros::motor_gearset_e, bool, pros::motor_encoder_units_e)” even though I have all the 4 arguments needed… here is a snippet of my code


code not working snippet1

please let me know if anyone knows how to fix this issue. I use VSCode using the PROS Operating System for VEX V5.

You are on PROS 4, which changes the motor constructors. It is now:

explicit Motor(const std::int8_t port, const pros::v5::MotorGears gearset = pros::v5::MotorGears::green,
	               const pros::v5::MotorUnits encoder_units = pros::v5::MotorUnits::degrees);

Most notably, there is now no argument to it for the reverse flag. If you want to reverse the motor, you now have to pass it a negative port. For example:

To create a forwards-running motor with a green cartridge:

pros::Motor(1, pros::v5::MotorGears::green, pros::v5::MotorUnits::degrees);

And that same motor reversed:

pros::Motor(-1, pros::v5::MotorGears::green, pros::v5::MotorUnits::degrees);
1 Like

I’ve looked at the documentation and everything but I can’t find the issue since the example code won’t work for me either. While you wait for someone smarter than me to help I did find that you can declare the motor with just the port and add all the other info after and that should work:

pros::Motor R1(1);
R1.set_gearing(pros::E_MOTOR_GEARSET_06);
R1.set_reversed(true);
R1.set_encoder_units(pros::E_MOTOR_ENCODER_DEGREES);
1 Like