A photo diode would work if the external resistance was set for the dim light being off. The more light the more they conduct so the sensitivity can be adjusted. Think of a regular transistor, light is the base.
Look at the count command if you are interested in finding the frequency of change.
Bookmarks