public class Photoresistor extends AnalogComponent
Unlike infrared detectors, photocells are good at detecting yellow/green visible light, but not infrared light.
This component uses an ADC (Anolog to Digital Converter) to transform the analog signal generated by the photoresistor variations.
Example Datasheet: Photoresistor
Example of use: PhotoresistorExample
ADC
adc
Constructor and Description |
---|
Photoresistor(ADC adc,
ADCChannel photoresistorChannel)
Constructor for a photoresistor using a specific ADC instance, and a specific
channel on this ADC to decode the analog input from the photoresistor.
|
Modifier and Type | Method and Description |
---|---|
int |
getIntensity()
Get the light intensity read from the photoresistor.
|
getADC, getType
public Photoresistor(ADC adc, ADCChannel photoresistorChannel)
adc
- the ADC to use to decode analogic signals from the photoresistor.photoresistorChannel
- the channel on the ADC used to read inputs from the photoresistor.