weatherstation/firmware/sensor_apds9930.ino

24 lines
506 B
Arduino
Raw Normal View History

#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;
}
2020-02-18 20:06:03 +01:00
}