// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, dirA, dirB);
The code and the comment do not agree. Fix, or delete, the comment.
void setup() {
// initialize the serial port:
pinMode(pwmA, OUTPUT);
digitalWrite(pwmA, HIGH);
pinMode(pwmB, OUTPUT);
digitalWrite(pwmB, HIGH);
// Turn off the brakes
pinMode(brakeA, OUTPUT);
digitalWrite(brakeA, LOW);
pinMode(brakeB, OUTPUT);
digitalWrite(brakeB, LOW);
// Log some shit
Serial.begin(9600);
pinMode(pin_A, INPUT);
pinMode(pin_B, INPUT);
}
What shield are you using? 90% of what you are doing here is wrong.
Is the rotary encoder attached to the stepper motor? If not, a simple potentiometer would be a far better choice of hardware to select the delay() interval with.