#include <Servo.
h>
// Define components
Servo servo1;
// LDR Sensor Module Pins (Digital Pins)
Const int ldr1 = 2; // Digital output of LDR 1
Const int ldr2 = 3; // Digital output of LDR 2
Const int ldr3 = 4; // Digital output of LDR 3
Void setup() {
// Attach servo
[Link](9);
// Initialize LDR sensor module pins
pinMode(ldr1, INPUT);
pinMode(ldr2, INPUT);
pinMode(ldr3, INPUT);
// Initialize servo
[Link](0);
[Link](9600);
Void loop() {
// Read LDR sensor module digital outputs (HIGH or LOW)
Int ldr1State = digitalRead(ldr1); // LOW = light detected
Int ldr2State = digitalRead(ldr2); // LOW = light detected
Int ldr3State = digitalRead(ldr3); // LOW = light detected
// Check the states of LDRs and adjust the servo dynamically
If (ldr1State == LOW && ldr2State == LOW && ldr3State == LOW) {
[Link](60); // All three lasers on
} else if (ldr1State == LOW && ldr2State == LOW) {
[Link](40); // Laser on LDR 1 and LDR 2
} else if (ldr1State == LOW) {
[Link](20); // Laser on LDR 1 only
} else {
[Link](0); // No lasers detected
// Debugging
[Link](“LDR States: “);
[Link](ldr1State == LOW ? “Light “ : “No Light “);
[Link](ldr2State == LOW ? “Light “ : “No Light “);
[Link](ldr3State == LOW ? “Light “ : “No Light “);
[Link]();
Delay(100); // Add delay for stability