# Does de stepper motor have a revolution limit?

Hello, I have an issue with my stepper motor program. I would like my program to accept an infinite numbers of turns, but it is limiting it to 163 turns and I don't know why. The user decides the number of revolutions with buttons and when they press the "botaoroda" button the motor rotates at the requested speed e quantity. I'm using 200 step motor. If for any reason it's not possible to have an infinite numbers of turns I would like to expand the limit at least. thank you!!

C++

``````currentMillis = millis(); // tempo decorrido desde a inicialização do programa

//Ao cliclar no botão mais, ocorre acréscimo +1 na variável "count"
if(botaomais==LOW){
count++ ;
delay(400);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Voltas: ");
lcd.print(count);
lcd.setCursor(0,1);
lcd.print("Vel: ");
lcd.print(vel);
lcd.print(" RPM");
}

/Acionamento do botão roda
if(botaoroda==LOW){

if(vel>0 && count>0){

Stepper.setAcceleration(10*(pow(vel,2))); // y=10x²
lcd.setCursor(0,1);
lcd.print("Vel: ");
lcd.print(vel);
lcd.print(" RPM");

for(int i=0;i<=volta; i++){
Stepper.runToNewPosition(i);

lcd.setCursor(0,0);
lcd.print("Volta atual: ");
volta_atual =count - (i/200);
if(volta_atual<10){lcd.print("0");}
lcd.print(volta_atual);
if(volta_atual==0){
lcd.clear();
lcd.setCursor(0,1);
}
}
}
}

startMillis = currentMillis;
Stepper.setCurrentPosition(0);
}

``````

Most likely, a math error like integer overflow. Post all the code.

For "infinite turns" just set the stepper to run at some desired speed.

thank youuu, the problem was overflow

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.