#include <Servo.h>
const int photoresistorPin1 = A0;
const int photoresistorPin2 = A1;
const int servoPin = 9;
Servo myServo;
void setup() {
myServo.attach(servoPin);
Serial.begin(9600);
}
void loop() {
int value1 = analogRead(photoresistorPin1);
int value2 = analogRead(photoresistorPin2);
Serial.print("Photoresistor 1: ");
Serial.print(value1);
Serial.print(" | Photoresistor 2: ");
Serial.println(value2);
int threshold = 50;
if (value1 > value2 + threshold) {
myServo.write(myServo.read() - 1);
} else if (value2 > value1 + threshold) {
myServo.write(myServo.read() + 1);
}
delay(100);
}