#include <ESP32Servo.h>
#define LDR_PIN 2

Servo elevationServo;

int pos = 75;
int LDR1 = 34;
int LDR2 = 33;
int d = 40;


void setup() {
elevationServo.attach(18);
  pinMode(LDR1, INPUT);
  pinMode(LDR2, INPUT);
}

void loop() {
 int analogValue1 = analogRead(LDR1);
  int analogValue2 = analogRead(LDR2);

  if (analogValue1 > analogValue2) {
    pos = pos+1;
    delay(d);
  }
  if (analogValue1 < analogValue2) {
    pos = pos-1;
    delay(d);
  }
  if (pos < 0) {
    pos = 0;
    delay(d);
  }
  if (pos > 180) {
    pos = 180;
    delay(d);
  }
  elevationServo.write(pos);
  delay(d);
}