i need help with this code. i have two motors in my project that i want to be set at a default angle of 0 degrees.
if (distance > 200) {
myservo1.write(70); // set servo to mid point
myservo2.write(0); // set servo to mid point
digitalWrite(LEDPinV, HIGH);
digitalWrite(LEDPinVI, LOW);
digitalWrite(Buzzer, HIGH);
}
else if (distance <= 200){
myservo1.write(0);
myservo2.write(70);
digitalWrite(LEDPinV, LOW);
digitalWrite(LEDPinVI, HIGH);
}
else {
myservo1.write(1);
myservo2.write(1);
digitalWrite(LEDPinV, LOW);
digitalWrite(LEDPinVI, LOW);
}
}
this is what i have so far but the problem is i need to set the distance as a range and not more than or less that 200. is there any way i can set it as distance = 10-200 or something like this ?