Mita

The following code will read the sensor value of the ambient light sensor and print the value to the console every 1 second.

every 1 second {
    var light = light.intensity.read();
    println(`Light: ${light}`);
}

Configurations

The following code offers an example for how to set up the Light Sensor.

setup light {
    manual_mode = true;
    continuous_mode = true;
    high_brightness = true;
    integration_time = MS_800;
}

If manual mode is set to true we could modify:

  • Integration Time

The integration time settings defines how long the Ambient Light Sensor collects light for a single measurement.

  • Continuous Mode

This mode allow that the light sensor continuosly measure the light intensity, once a measurement is finished and the result stored, the next one ins immediately started.

  • High Brightness

    This mode, only 1/8 of the photo diode current is used as input for the Analog to Dialog Converter (ADC). This setting is used in high-brightness situations to avoid saturation/clipping effects of the ADC.

Last updated

Was this helpful?