/* Here the LDR photoresistor is tested with Arduino. 2 LEDs are paired to the different light values to simulate an indoor response to sunny, overcast, and dark natural lighting conditions The application of further development of this test could be useful in vertical farming systems and smart lighting services for industrial buildings/homes with many windows and architectural utilization/ reliance on natural light. */ int light = 0; // store current light value void setup() { Serial.begin(9600); pinMode(13, OUTPUT); // setting LEDs to visualize changes in lighting in the given pin IDs. pinMode(12, OUTPUT); } void loop() { light = analogRead(A0); // read the light value from the LDR photoresistor. Serial.println(light); if (light > 450) { // when its bright (i.e greater than 450Ohms), both LEDs will be off to save eergy) Serial.println("It very bright, lots of natural light"); digitalWrite(13, LOW); digitalWrite(12, LOW); } else if (light > 229 && light < 451) { //medium amount of light to show one LED at a time). Serial.println("moderate light quantity, quite cloudy"); digitalWrite(13, HIGH); digitalWrite(12,LOW); } else { // both LEDs turn on when the surroundings are dark. Serial.println("It very dark, extremely overcast or night time"); digitalWrite(13, HIGH); digitalWrite(12, HIGH); } delay(750); // 750ms time delay for sensor readings. }