// Stepper motor on Wokwi!
#include <Stepper.h>
#include "RTClib.h"
int stepsPerRevolution = 6;
int a = 0;
int i; // change this to fit the number of steps per revolution
// for your motor
RTC_DS1307 rtc;
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
void setup() {
// set the speed at 60 rpm:
// initialize the serial port:
Serial.begin(9600);
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
abort();
}
}
void loop() {
DateTime now = rtc.now();
for(a = i; i < now.minute(); i++){
if(a < now.minute()){
myStepper.step(stepsPerRevolution);
myStepper.setSpeed(15);
}else{
myStepper.step(stepsPerRevolution = 0);
}
}
Serial.print(a);
}