Using a photoresistor as a switch