I am using the Arduino Uno and am trying to control a stepper motor. I’m getting the error(“break statement not within loop or switch ) when I try and compile the following code: I want to break out of the loop if the first “if statement is true” Any suggestions??
void loop()
{
//Stepper motor will turn 90 degrees counterclockwise, VALVE WILL OPEN
if (ValveStatus==1) {
break; }
else if ((duration/74/2)<5) {
Serial.println (“OPEN VALVE”);
myStepper.step( -stepsPerRevolution);
delay(500);
ValveStatus++;
}
if (Valve_Status != 1)
if (…
etc.
message edited by ijack