"error: break statement not within loop or switch" in arduino one

519 views Asked by At

i don´t have any idea of coding but i´m doing a school exersice and it gives me the error of the title

while (distancia<200 && distancia>100);
{

  lcd.print("ALTO");
  delay(1000);
  lcd.clear();
  delay(1000);

  if(distancia<100)
  {

   break;
  }
}
 if(distancia<100);
  {

    lcd.print("INTRUSO EN");
    lcd.setCursor(0,1);
    lcd.print("LA PUERTA");
    tone(11,700,250);
    digitalWrite(8,HIGH);
    delay(500);
    lcd.clear();
    digitalWrite(8,LOW);
    delay(500);
}
}

It is in arduino and I want that it returns to the first while if (100<distancia) and that ("ALTO") disapear when (distancia<100), pls help, I have no idea of what I´m doing

1

There are 1 answers

4
pm100 On BEST ANSWER

Here

  while (distancia<200 && distancia>100);
  --------------------------------------^

remove that semicolon, it terminates the while right there

    while (distancia<200 && distancia>100)