Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By sblantipodi
#83525 Guys,
is it possible to move a stepper motor on ESP8266 whle displaying a scrolling text on an OLED display?

am trying to write a stepper motor non blocking code
I am able to turn on and off a led using the famous non blocking piece of code
but I'm not able to write a loop that moves the stepper motor without blocking the code
basically I need to do a loop, that loops 4000 times delaying 1 milliseconds on each loop
how can I do it?

Code: Select allint stepLeft = 4500;
while (stepsLeft > 0) {   
      doSomething();
      stepsLeft--;
      delay(1);
}


how can I write this loop without blocking my display?
User avatar
By sblantipodi
#83531
btidey wrote:Use a timer interrupt routine to run the stepper logic so that it is done in the background. Then other foreground tasks can execute fairly independently of the stepper timing.


I'm not able to smoothly run the stepper motor and scroll text on oled display at the same time

it all happen in the same loop, but every time I call the draw function, the motor rettle because the diplay function need a lot of microseconds, any solution to the problem?