I am new to coding, I am writing a simple code for running the stepper motor, where I need to control the motor speed with the data from the array. However, I want to loop the action for a certain period of time ( like 1 minute) for each array data, I try to add a while loop in side the for loop, and it just stuck at the action of the first array data. Can anyone help to see which part I am doing wrong, many thanks.
#include <Stepper.h>
int numberofstep=2048;
Stepper motor(numberofstep, 8, 10, 9, 11);
float myarray[] = {1, 0.2, 0.8, 0.2};
unsigned long startMillis;
unsigned long currentMillis;
const unsigned long period = 5000;
the .step() function only takes a defined number of steps and then stops. It has nothing to do with time based movement like running for 1 minutes or something
Can you please mark the most helpful post as the solution? This prevents helpers spending time on a solved issue and it will lead people with the same question to the correct answer directly.
And while you are at it, you may want to read the guidelines regarding code tags.