upm  0.8.0
Sensor/Actuator repository for libmraa (v1.1.1)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions
APDS9930 Class Reference

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 = new upm::APDS9930(4);
// Kernel driver implement sleep 5000-5100us after enable illuminance sensor
light_proximity->enableIlluminance(true);
// Kernel driver implement sleep 5000-5100us after enable proximity sensor
light_proximity->enableProximity(true);
// Tested this value works. Please change it on your platform
usleep(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;
sleep(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
iiodevice 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: