Hello this program ir is working perfectly fine but i want to improve it .
-The first thing is i need to make the stepper turn one time every 5minute but i need the program to continue to turn when the stepper is moving with millis() .
-Secondly i don't want the stepper to turn all day long but only when i press a button like imagine the watch is in position 0pm and i press 1:05h latter the button the watch had to go on position 1:05pm direclty .
The problem , i have to idea how to do it .
So if you have links to learn something helpful for my project thx.
#include <Stepper.h>
int i;
const int stepsPerRevolution = 20; // change this to fit the number of steps per revolution
// for your motor
Stepper myStepper1(stepsPerRevolution, 2, 3, 4, 5);
Stepper myStepper2(stepsPerRevolution, 10, 11, 12, 13);
void setup() {
// set the speed at 60 rpm:
myStepper1.setSpeed(60);
myStepper2.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
for(i = 0; i<12 ; i++ ) {
myStepper2.step(stepsPerRevolution); // 05min
delay (300000);
}
for(i = 13; i<14 ; i++ ) {
myStepper1.step(stepsPerRevolution); //1h
delay (3600000);
}
}