#define DO_PIN 2 // Arduino's pin connected to DO pin of the ldr module
void setup() {
Serial.begin(9600);
// initialize the Arduino's pin as an input
pinMode(DO_PIN, INPUT);
}
void loop() {
int lightState = digitalRead(DO_PIN);
if (lightState == HIGH)
Serial.println("The light is NOT present");
else
Serial.println("The light is present");
}