32 lines
528 B
C++
32 lines
528 B
C++
#include <APDS9930.h>
|
|
|
|
APDS9930 _sensor_apds9930 = APDS9930();
|
|
|
|
bool sensor_apds9930_begin()
|
|
{
|
|
bool status = _sensor_apds9930.init();
|
|
|
|
if (status)
|
|
{
|
|
_sensor_apds9930.enableLightSensor(false);
|
|
debug("APDS9930 Connected");
|
|
|
|
} else {
|
|
debug("Could not find a valid APDS9930 sensor, check wiring!");
|
|
}
|
|
|
|
return status;
|
|
}
|
|
|
|
float apds9930_light()
|
|
{
|
|
float ambient_light = 0;
|
|
|
|
if (_sensor_apds9930.readAmbientLightLux(ambient_light))
|
|
{
|
|
return ambient_light;
|
|
|
|
} else {
|
|
return 0;
|
|
}
|
|
}
|