PROS Help

Does anyone know how to use a programming kit with PROS?

Also how do I switch the direction of my motors if they are included in an array?

EX.

int driveMotors [4] = {2,3,4,5};

motorSet( 2, driveMotors [4] )

NOTE: This is an example piece of code, not actually implemented

THANK YOU!!

The programming kit is not used any differently than you normally would. Use it in between a Joystick and computer and you can use your joystick with the Cortex. The flashing utility supports the programming kit (not that the utility needs to significantly compensate for the programming kit).

I’m not sure what you’re asking in your second question. If I’m understanding correctly, you have an array of motor ports that represent your drive motors and you want to use them as a group with the possibility of inverting individual motors?

If so, here’s an example of what you could do.


#define NUM_DRIVE_MOTORS 4

int driveMotors[NUM_DRIVE_MOTORS] = {2, 3, 4, 5};
int driveInversion[NUM_DRIVE_MOTORS] = {-1, 1, 1, -1}; // inverts motors 2, 5

void opcontrol() {
    // ...
   int newPWMValue = 127;
    for(size_t i = 0; i < NUM_DRIVE_MOTORS; i++)
          motorSet(driveMotors*, newPWMValue * driveInversion*);
    // ...
}

I think a better solution might be to use the subsystem module methodology, outlined here.

Ok thanks

I was trying shorter way without typing a declaration for each of the motors.