Declaring and using motors

Im trying to control an intake motor seperately from my drivetrain in EZ template. However im getting several match call errors.

void opcontrol() {
  pros::Motor intake(6);

      if (master.get_digital(DIGITAL_A)){
        intake = -127;
      }
      else if(master.get_digital.(DIGITAL_A)){
        intake = 0;
      }

It looks like there are a few issues:

  1. The second time you call master.get_digital(DIGITAL_A) you accidentally put a . after master.get_digital. This will cause a compiling error.
  2. Using intake = voltage; no longer works in PROS. You should use intake.move(voltage);. For example spinning the intake backward at full speed would be intake.move(-127);.
  3. Currently your conditionals that manage the intake seem to be checked only once. Any code that reacts to a button press should be run in a loop (i.e. while(true) { } ) (Don’t forget to put a small delay in the loop so that your brain has time to perform other processes.)

A great place to learn about how PROS works is… their own documentation.
PROS documentation
PROS 4 C++ motor movement functions

1 Like

Thanks. I totally shouldve notice the extra period, but I guess my dyslexia was getting to my late at night. Thanks.