SL06 Module¶
This is a module for the SL06 Digital Proximity, Ambient Light, RGB and Gesture Sensor. The board is based off the APDS-9960 manufactured by Avago Technologies. The board uses I2C for communication.
Data Sheets:
SL06 class¶
-
class
SL06
(drvname, addr=0x39, clk=100000)¶ Creates an intance of the SL06 class.
Parameters: - drvname – I2C Bus used ‘( I2C0, ... )’
- addr – Slave address, default 0x39
- clk – Clock speed, default 100kHz
-
init
()¶ Configures APDS-9960 by initializing registers to its default values. Call immediately after instantiating the SL06 class. Raises an exeption if any error occurs during initialization.
Returns True if initialization is successful.
-
getMode
()¶ Returns the mode of the sensor
-
setMode
(mode, enable)¶ Sets the desired mode on APDS9960. Exception raised if unsuccessful.
Parameters: - mode – desired mode. AMBIENT_LIGHT, PROXIMITY, GESTURE.
- enable – accepts 1 or 0
Returns True if successful
-
enableLightSensor
(interrupts)¶ Begins the light sensor. Exception raised if unsuccessful.
Parameters: interrupts – Input True to enable hardware interrupt on light level. Defaults to False
-
disableLightSensor
()¶ Disables the light sensor.
-
enableProximitySensor
(interrupts)¶ Begins the proximity sensor. Exception raised if unsuccessful.
Parameters: interrupts – Input True to enable hardware interrupt on proximity detection. Defaults to False
-
disableProximitySensor
()¶ Disables the proximity sensor.
-
enableGestureSensor
(interrupts)¶ Begins the gesture sensor. Exception raised if unsuccessful.
Parameters: interrupts – Input True to enable hardware interrupt on gesture detection. Defaults to False
-
disableGestureSensor
()¶ Disables the gesture sensor. Exception raised if unsuccessful
-
isGestureAvailable
()¶ Checks whether a gesture was detected.
-
getGesture
()¶ Processes a gesture event and returns best guessed gesture.
Returns the gesture direction as a string literal.
-
enablePower
()¶ Turns APDS9960 on
-
disablePower
()¶ Turns APDS9960 off
-
getAmbientLight
()¶ Reads the ambient light measurement. Exception raised if unsuccessful
Returns the ambient light measurement.
-
getRedLight
()¶ Reads the red light level. Exception raised if unsuccessful.
Returns the red light level.
-
getBlueLight
()¶ Reads the blue light level. Exception raised if unsuccessful.
Returns the blue light level.
-
getGreenLight
()¶ Reads the green light level. Exception raised if unsuccessful.
Returns the green light level.
-
getProximity
()¶ Reads the proximity level. Exception raised if unsuccessful.
Returns the proximity level.