Hi all,
Been using this site as a reference for my projects for awhile now and thought I’d try to get some help with a problem I have. I have a loop that turns on a set of Stepper Motor Sequences and I’m trying to include 3 buttons: Restart, Pause, Resume so that one button will restart the loop, one button will pause the loop and one button will resume the loop. I figured out how to have the loop start at the push of a button and I included the code below. Any takers?
int myCounter = 0;
int mySwitchPin = 4;
void setup() {
pinMode(mySwitchPin, INPUT_PULLUP);
}
void loop() {
if(myCounter<5) {
doSomething();
myCounter = myCounter + 1;
}
else if(digitalRead(mySwitchPin) == LOW) {
myCounter = 0;
}
}