Comment on page
Light
Python Library for Broadcom APDS-9960 Ambient & RGB Light, Proximity and Gesture Detection Sensor.
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.
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.)
Reads the ambient light value.
read_ambient_light()
Parameters
None Returns
Int: Ambient light value.
Reads the CRGB light values.
read_crgb_light()
Parameters
None Returns
Int[]: Clear, red, green and blue light values respectively.
Reads the proximity value.
read_proximity()
Parameters
None Returns
Byte: Proximity value.
Detects hand gestures.
read_gesture()
Parameters
None Returns
GESTURES: Gesture direction if gesture is detected, None if not.
Sets the sensor mode.
set_mode(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 modified 4yr ago