Light

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.

Initialization

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

LightSensor

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.

read_ambient_light()
  • Parameters

    • None

  • Returns

    • Int: Ambient light value.

Read Clear and RGB Light

Reads the CRGB light values.

read_crgb_light()
  • Parameters

    • None

  • Returns

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

Read Proximity

Reads the proximity value.

read_proximity()
  • Parameters

    • None

  • Returns

    • Byte: Proximity value.

Read Gesture

Detects hand gestures.

read_gesture()
  • Parameters

    • None

  • Returns

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

Advanced Members

Set Mode

Sets the sensor mode.

set_mode(mode)
  • Parameters

    • MODES mode: Sensor operating mode.

  • Returns

    • None

Finalizer

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

Last updated