weatherstation/firmware/sensor_apds9930.ino

24 lines
505 B
Arduino
Raw Permalink 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;
}
2022-05-16 14:26:17 +02:00
}