Hi,
{
if(photores==500)angulo+=45;
angulo=(angulo,0,180);
servo1.write(0);
Serial.println(angulo);
delay(10);
}
You need to check how you structure an if.. statement.
Also in your code you are writing a value of 0 to the servo not angulo that you are printing on the monitor.
Also trying to act on an exact value will cause the servo to jitter, because in the above example, you will not be able to hold a value of exaclty 600.
if(photores>450 && photores < 550)
Will give you a relatively stable range.
Did you look at the map function linked for you?
You will not need a string of if.. statements.
Tom.. ![]()