byte ldr = A5;
byte led = 9;
int value;
int testValues[] = {100, 300, 600, 900}; // Array of test values simulating different light levels
int currentIndex = 0;
int numTestValues = sizeof(testValues) / sizeof(testValues[0]);
void setup() {
Serial.begin(9600);
pinMode(led, OUTPUT);
}
void loop() {
// Simulate LDR reading by using predefined test values
value = testValues[currentIndex];
// Print the simulated LDR value
Serial.print("Value of LDR : ");
Serial.println(value);
// Check the simulated value and control the LED accordingly
if (value < 500) {
digitalWrite(led, HIGH); // Turn on LED for dark condition
Serial.println("Dark condition, light on");
} else {
digitalWrite(led, LOW); // Turn off LED for bright condition
Serial.println("Bright condition, light off");
}
// Update index for next test value
currentIndex = (currentIndex + 1) % numTestValues;
delay(1000); // Wait for 1 second before the next iteration
}