upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions

APDS9930 Digital Proximity and Ambient Light Sensor. More...

Detailed Description

This sensor provides digital ambient light sensing (ALS), IR LED and a complete proximity detection system.

// Instantiate a Digital Proximity and Ambient Light sensor on iio device 4
upm::APDS9930 light_proximity(4);
// Kernel driver implement upm_delay 5000-5100us after enable illuminance
// sensor
light_proximity.enableIlluminance(true);
// Kernel driver implement upm_delay 5000-5100us after enable proximity sensor
light_proximity.enableProximity(true);
// Tested this value works. Please change it on your platform
upm_delay_us(120000);
while (shouldRun) {
float lux = light_proximity.getAmbient();
cout << "Luminance value is " << lux << endl;
float proximity = light_proximity.getProximity();
cout << "Proximity value is " << proximity << endl;
upm_delay(1);
}
light_proximity.enableProximity(false);
light_proximity.enableIlluminance(false);

Public Member Functions

 APDS9930 (int device)
 
 ~APDS9930 ()
 
int getAmbient ()
 
int getProximity ()
 
bool enableProximity (bool enable)
 
bool enableIlluminance (bool enable)
 

Constructor & Destructor Documentation

APDS9930 ( int  device)

APDS-9930 digital proximity and ambient light sensor constructor

Parameters
deviceiio device number
~APDS9930 ( )

APDS9930 destructor

Member Function Documentation

int getAmbient ( )

Gets the ambient luminance value from the sensor

Returns
Ambient Luminance value
int getProximity ( )

Gets the proximity value from the sensor

Returns
Proximity value
bool enableProximity ( bool  enable)

Enable proximity

Parameters
enablestate
bool enableIlluminance ( bool  enable)

Enable illuminance

Parameters
enablestate

The documentation for this class was generated from the following files: