Hi!
I'm quiet new this programming.
I'm trying to rotate my stepper motor using a push button for a certain angle. The push button is deteced only st the beginning. the loop is not continue.
I need some urgent help pleeeeaseeeeeee...
Thank u in advance!
below is the code I'm using
#include <Stepper.h>
const int button=2;
const int stepsPerRevolution = 200;
int buttonState = 0;
Stepper myStepper(stepsPerRevolution,13, 12, 11, 10);
boolean section = false;
void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
pinMode(button, OUTPUT);
}
void loop(){
buttonState = digitalRead(button);
if (buttonState==HIGH){
if(section==LOW){
myStepper.step(100); // turningthe motor to 25 steps to get 45 degree rotaion
section=true;
}
}
}