I do not see anything obviously wrong with your code. It looks like it sets the motors to maximum speed in the forward direction (motor driver outputs corresponding to current flowing from output A to B). So, if that behavior is what you want, it sounds like it will work for you.
As for the difference in those functions, calling
flipM2() with an argument of
true flips the meaning of “forward” and “reverse”, which means that any subsequent calls to
setSpeeds() will take the new meaning of “forward” and “reverse” into account. Whereas, calling
setSpeeds() with a negative speed value simply commands the motor to rotate in reverse (and the meaning of “forward” and “reverse” does not change). One example of how
flipM2() can be useful is when code (like our example sketch, Motors.ino) is already written and the motors are wired in a way that the forward direction does not make sense for the system. Instead of rewiring the motors, you can use the
flipM2() commands to accomplish the same thing as rewiring the motors, except in code.
You can learn more about how all of the functions in the A-Star library work by reading about them in the AStar32U4 library documentation.