I recently aquired a Bricktronics MegaShield and while I don't know much about arduino programming, I've been trying to learn via the great examples you've shared! I want to control multiple motors by using the PID function and assiging angle positions but I'm not sure how to modify the code to add a second motor. I got the example working when I hooked up 1 motor just fine, making it go forward and then reverse. But I'd like the ability to control each wheel with its own motor for better turns. So here's what I've done so far:
I added another motor in the include section, and added an m2 for the begin and the update functions.
Then, in my loop, I want m2 to go forward to the 30 degree angle and return back to the original position and then the other motor do the same motion. However, when I run the code, only m2 moves and nothing else happens. It's as if it obeys the first line of the code and ignores the rest. What am I doing wrong/how can I fix this? Any help is appreciated! Below is my entire code for reference since I feel like I'm not explaining this well enough.
include < Encoder.h>
include < PID_v1.h>
include < BricktronicsMotor.h>
include < BricktronicsMegashield.h>
// Reset the current position to "angle 0"