ambient Light
Get the amount of ambient light dectected.
sensors.color1.ambientLight()
The amount of ambient light measured is in the range of 0
(darkest) to 100
(brightest).
Returns
- a number that is the amount of ambiernt light measured. No light (darkness) is
0
and the brightest light is100
.
Example
Make the status light show green
if the ambient light is greater than 20
.
forever(function () {
if (sensors.color1.ambientLight() > 20) {
brick.setStatusLight(StatusLight.Green)
} else {
brick.setStatusLight(StatusLight.Orange)
}
})