
201Chapter 10: Taking the Next Steps
we place a 1 in the parentheses. Next, we need to establish which pins on
our Arduino are connected to the PWM and DIR pins on the stepper-motor
driver. In our circuit, we’re using digital pins 9 and 8, so they also go within
the parentheses. The last item we need to establish in the code above our
void setup is the variable we’re using to store our target angle—in this case,
45 degrees.
Next, in our void setup, we need to do three things: Set our maximum speed
and acceleration (both to 1000) and tell the stepper motor that wherever it is
at the beginning of the program should be considered its 0 position. ...