added function to modularize the check on photoresistors