Light Class
- ID: light
- Name: Analog Light Sensor
- Category: light
- Manufacturer: seeed
- Connection: analog
- Kit: gsk
The light sensor detects the intensity of the ambient light. As the light intensity of the environment increases, the resistance of the sensor decreases. This means the raw value from the analog pin is larger in bright light and smaller in the dark. A very approximate lux value can also be returned.
Item Index
Methods
Light
-
pin
Analog light sensor constructor
Parameters:
-
pin
NumberAnalog pin to use
Returns:
raw_value
()
Number
Gets the raw value from the AIO pin
Returns:
Raw value from the ADC
value
()
Number
Gets an approximate light value in lux from the sensor
Returns:
Approximate light reading in lux
setAref
-
aref
Set ADC reference voltage
Parameters:
-
aref
NumberADC reference voltage
setScale
-
scale
Set sensor scale. This scale is applied to the return value: counts = counts * scale
Parameters:
-
scale
Numbercount scale value used
setOffset
-
offset
Set sensor offset. This offset is applied to the return value: value = value + offset
Parameters:
-
offset
Numbercount offset value used
getAref
()
Number
Get sensor aref
Returns:
Sensor ADC reference voltage
getScale
()
Number
Get sensor scale
Returns:
Sensor scale
getOffset
()
Number
Get sensor offset
Returns:
Sensor offset
getNormalized
()
Number
Read normalized value for sensor
Returns:
Function result code
getRawVolts
()
Number
Read raw voltage from the sensor
Returns:
Function result code