Garden lamps control

I would like to control garden lamps with ldr sensor and arduino. Lamps should turn on after it is getting dark. After some time it should turn of despite it is still dark outside. It should start on again after that when it becomes dark again.

How I could improve this code

void loop()

sensorValue = analogRead(sensorPin);

if (sensorValue < 100)

digitalWrite(led,HIGH);

delay(1000);

}

digitalWrite(led,LOW);

delay(sensorValue);

}

Please read "How to use the forum", especial the part about posting code.

But what have you tried? What didn't work about it?

And as literature, did you look at "Blink without delay"?

Isnt it clear what does not work ? I think I have written everything to describe this problem. What purpose of this forum? Try to show someone else that you are very clever ? But where is yours answers ?

The problem is that. Lamps cant turn again after timer ends if sensor value is till in the same range. For example. Lamps should start if sensor value is less than 100. But lamps can not turn on again if the sensor value not become 100 or more and then less than 100

void loop()



sensorValue = analogRead(sensorPin);

How I could improve this code

By making it compilable

Isnt it clear what does not work ?

Code that does not compile cannot run. If it cannot run, it cannot be said work or not work.