stepper speed control with adafruit motor shield and potentiometer

Hello,

i´m trying to control the speed of a stepper motor with an adafruit motor shield v1, an arduino mega 2560 and a 10k potentiometer.
here is my code

#include <AFMotor.h>
AF_Stepper stepper(100, 2);
int drehzahl, poti, poti2;

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
 poti= analogRead(A7);
 if (poti>5){
  poti2 = map ( poti,0,1023,0,20);
 stepper.setSpeed(poti2);
stepper.step(100,FORWARD,DOUBLE);   

 }                                                                                                                                                                                                                                          
}

my problem:
when the potentiometer has the value 0, the stepper doesn´t work => ok for me
but when I change the value of the potentiometer, the stepper doesn´t work anymore.
I also tried without the if-loop. it´s still not working :frowning:

can somebody please help me?
thanks in advance

Wiring diagram? How many steps per revolution is your motor? Have you tried speeds greater than 20?