#include <Stepper.h>
uint32_t t, t2;
bool stato;
Stepper myStepper(200, 8, 9, 10, 11);
void setup() {
pinMode(2, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
if(!digitalRead(2)){
if(millis()-t2>=250){
stato=!stato;
t2=millis();
}
}
if(stato){
if(millis()-t>=100){
myStepper.step(1);
t=millis();
}
} else {
myStepper.step(0);
}
}