Advertisement
Device & Sensors
Ambient Light Sensor Demonstration
Read ambient room illuminance levels in Lux units.
Checking support...
Feature Not SupportedThis browser does not support the Ambient Light Sensor Web API feature. Try testing in a modern browser (such as Chrome, Edge, Safari, or Firefox).
Advertisement
Interactive Input Workspace
Ready for input
Web API Execution Output
Result output will be displayed here after execution...
Native JavaScript Code Example (Zero Libraries)
if ('AmbientLightSensor' in window) {
const sensor = new AmbientLightSensor();
sensor.onreading = () => console.log(sensor.illuminance);
sensor.start();
}About the Ambient Light Sensor Web API
AmbientLightSensor interface returns current light intensity in Lux.
Specification:W3C & WHATWG Web API Standard
Sponsored Content