I already posted this question in the adafruit forum, but I think someone here can answer it as well.
I bought a motorshield from Adafruit for my robotics project. It comes with an AFMotor library from which I can create an object representing a DC motor. To create this object I have to supply two parameters.
The example shows the command
AF_DCMotor motor(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
to define an object called motor with the given specs. But I want to define multiple motor objects in an array where the max number of the array can be defined with a Const value:
const int mm = 4;
AF_DCMotor Motor1[mm];
and then set the values like the motor numbers and frequency.
I want my code to be flexible to use in more than one project without having to change a lot of code in the Arduino sketch. Is there a way to create this array of objects and still set their properties (obviously the motornumber is not the same for all created objects...)?