Dear forum users,
i have got a problem with programming the servo in arduino. I want the servo to go to certain value with a for loop. The servo should go from 180 to 0 in 1 degree steps and should stop if a value of a sensor is exceeded. Here is the for loop that I wrote:
if (button2Status == HIGH)
{
for (pos = 180; pos >= 0; pos -= 1)
{
if(FSRvalue > 900)
{
break;
}
myservo.write(pos);
delay(250);
}
The problem is, that it does not stop if the sensor value is exceeded.
It would be very kind if someone could help me
Greetings