So, what does this speed correlate to "speed = 127;" Vs. this one "motor.setSpeed(200);" what are these 2 "Speeds" telling it to do?
Look at the source code for the AFMotor library.
The shield uses two pins to control a motor. One sets the direction. That is what the run() method is controlling. Setting the pin HIGH makes the motor turn one way. Setting it LOW makes it turn the other way.
The other pin is a PWM pin and controls the speed of the motor, by using analogWrite(). The value defines the ratio of on time to off time for the pin. The higher the on time ratio, the faster the motor goes.
Yes, I know the difference between Global and Local, trial and error.
OK. So, when I put a comment next to the code that said that it needed to be a global variable, why did you make it a local variable?