Code for functionality of photoresistor