const int lightSensorPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(lightSensorPin);
Serial.print("Light level: ");
Serial.println(sensorValue);
if (sensorValue < 300) {
Serial.println("Light is ON");
} else {
Serial.println("Light is OFF");
}
delay(1000);
}