Ambient Light Sensor
Goals
Get the ambient light sensor and subscribe to updates
// Get the ambient light sensor via its device identifer
ambientLightSensor = devices.getDeviceByIdentifier(259);// We want to be informed when a new sensor value arrives
ambientLightSensor.registerListener(ambientLightChanged);function ambientLightChanged(val) {
// Do something with the value object
}Reading the light value
Last updated