I started with the stock DCMotorTest code and I have added
- Code: Select all | TOGGLE FULL SIZE
while( !Serial );
after the
- Code: Select all | TOGGLE FULL SIZE
Serial.begin(9600)
this is to give the Leonardo a chance to get the Serial port initialized before printing to it. Otherwise even the initial "Adafruit Motorshield v2 - DC Motor test!" does not show up on the Serial monitor. With this, the motor will start cycling back and forth a couple of times. The very first "tick" will sometimes show up. The later strings "tock" and "tech" rarely show up. How far the code will proceed is different every time I upload the sketch. The code seems to run for a few cycles of the motor speed cycling up and down, but the messages printed to the Serial monitor fail to show up. After some number of cycles of the motor running back and forth according to the code, it just starts running very fast at a constant speed and will not be interrupted by the reset button. The power supply never shows more than about 125 mA.
Why does printing to the Serial monitor stop working? Why does the motor go into the single speed situation? I would appreciate any ideas on what I may be doing wrong.
-- mike