Python Library for Broadcom APDS-9960 Ambient & RGB Light, Proximity and Gesture Detection Sensor.

Python Library

Turta_Light library is responsible for reading light, proximity and detecting gesture from the APDS-9960 sensor.


Add the following statement to the top of your Python code.

from turta_iothat3 import Turta_Light

Then, create an instance of the LightSensor class.

light = Turta_Light.LightSensor()

Now you're ready to access the library by calling its instance.

Initialization Parameters


Initiates the APDS-9960 sensor to get ambient light, RGB light, proximity and gesture data.

Turta_Light.LightSensor(mode, pypass_int)
  • Parameters

    • MODES mode: Sensor operating mode. (MODES.ALS_RGB is default.)

    • Bool pypass_int: Enables checking gesture interrupt without using the interrupt pin. Decreases performance on incorrect use. Only set True if you're listening the interrupt pin on the main application code. (False is default.)

Basic Members

Read Ambient Light

Reads the ambient light value.

  • Parameters

    • None

  • Returns

    • Int: Ambient light value.

Read Clear and RGB Light

Reads the CRGB light values.

  • Parameters

    • None

  • Returns

    • Int[]: Clear, red, green and blue light values respectively.

Read Proximity

Reads the proximity value.

  • Parameters

    • None

  • Returns

    • Byte: Proximity value.

Read Gesture

Detects hand gestures.

  • Parameters

    • None

  • Returns

    • GESTURES: Gesture direction if gesture is detected, None if not.

Advanced Members

Set Mode

Sets the sensor mode.

  • Parameters

    • MODES mode: Sensor operating mode.

  • Returns

    • None


When exiting from the program, the library turns off the sensor and releases the GPIO pin.

Last updated