 The next time you need to add light and dark detection to a project, skip the photoresistor and reach for a phototransistor. They're generally more sensitive, plus they're ROHS compliant, using less toxic ingredients to manufacture. Being a type of transistor, you might expect to see three legs, but a phototransistor only has two leads because its base is essentially replaced by light sensitivity. If you've ever wired a photoresistor up to a microcontroller, using a phototransistor will look familiar. Connect the longer lead to positive voltage and the shorter one through a 1 to 10k resistor to ground. Connect the microcontroller's analog input to the point between the resistor and phototransistor. You can adjust the phototransistor's output voltage by changing the value of that resistor.