combining source code limit switch with servo continuous

orry I wanted to ask, I was making a prototype for an automatic clothesline that uses a continuous servo to control the spin of the wheel, which I am confusing is controlling its son by using a limit switch, here I use 2 limit switches connected on PIN 7 and this is the source code for his clothesline…

#include <Servo.h>

Servo myservo;
int pos;
int ldr=0;
int senhu;

void setup ()

pinMode(2, OUTPUT);

void loop(){
ldr = analogRead(A0);
senhu = analogRead(A1);

if(ldr>=500 && ldr<600){
else if(ldr>=600 && ldr<700){


so is there anyone can help me to add source limit switch on souce code above ??
thank you

You obviously need to read the state of pin 7. Do you know how to do that ?

You have used pin 7 as the input for limit switches for both directions which makes things more complicated, but it can be done. Could you use different pins for each limit switch ?

When you do discover that a given limit switch is pressed, do you know what to do then?