How would I change this code to make the stepper motor go in reverse?
#include <Stepper.h>
int in1Pin = 8;
int in2Pin = 9;
int in3Pin = 10;
int in4Pin = 11;
Stepper motor(512, in1Pin, in2Pin, in3Pin, in4Pin);
void setup()
{
pinMode(in1Pin, OUTPUT);
pinMode(in2Pin, OUTPUT);
pinMode(in3Pin, OUTPUT);
pinMode(in4Pin, OUTPUT);
// this line is for Leonardo's, it delays the serial interface
// until the terminal window is opened
while (!Serial);
Serial.begin(9600);
motor.setSpeed(20);
}
void loop()
{
if (Serial.available())
{
int steps = Serial.parseInt();
motor.step(steps);
}
}