I want to make a photoswitch light based on LDR that would turn on in absence of sunlight and turn off in presence of sunlight. But the problem is when the light goes on it causes LDR to turn the light off and when light goes off it will cause LDR to turn it on and hence it will be an endless loop. It can be solved by placing LDR circuit outside the room but due to some limitations, I can not do that. One solution would be that I can check if turning the room light on and then off has any effect on LDR or not and if it has effect then keep the lights on because if it has no effect then it must mean there is sunlight present in the room so no need to turn on light. But I cannot design any circuit of the given implementation. Can anybody suggest me circuit to do the given job? (This is my first post to forum So I dont know if it is valid question or not. Also sorry for bad English).