light_sensor - Ambient Brightness

On the harmonic board, there is an IR-LED which can be used in reverse as a crude brightness sensor. Values returned are in no particular unit but seem to be fairly stable.


Turn on the ADC and start reading brightness values. (In past this function must be called before any measurements can be taken.)


Get an ambient brightness reading. The returned value is in no particular unit, though it seems to be fairly stable. The value could be between 0 and 400. Common values:

  • ~8: Very dark are

  • ~17: Typical hackerspace brightness

  • >200: Direct sunlight


A brightness reading in no particular unit


Stop the ADC.

Direct readout of the light-sensor.

Use this function for low latency readout. The time between polls can have an effect on the values measures. If you do not need low latency, prefer light_sensor.get_reading().

New in version 1.8.