A class to configure and read the Vishay VEML6030 ambient light sensor. More...
#include <Lightsensor.h>
Public Member Functions | |
| void | begin () |
| Initialize the VEML6030 light sensor. | |
| LightSensor (uint8_t sdapin, uint8_t sclpin) | |
| Construct a new LightSensor object. | |
| uint32_t | readLight () |
| Read the current light level in lux. | |
| void | stop () |
| Stop the sensor. | |
A class to configure and read the Vishay VEML6030 ambient light sensor.
The VEML6030 is a high-sensitivity ambient light sensor connected through the I2C bus at address VEML6030_I2C_ADDR (0x10). It provides a 16-bit dynamic range and adjustable gain and integration time for accurate lux readings.
Default connections:
| Signal | I2C Macro | GPIO | Description |
|---|---|---|---|
| SDA | DEFAULT_I2C_SDA_PIN | 12 | I2C data |
| SCL | DEFAULT_I2C_SCL_PIN | 13 | I2C clock |
| Address | VEML6030_I2C_ADDR | 0x10 | Light sensor I2C address |
| Interrupt | VEML6030_INTERRUPT | 9 | Optional interrupt output |
{@
| LightSensor::LightSensor | ( | uint8_t | sdapin, |
| uint8_t | sclpin ) |
Construct a new LightSensor object.
| sdapin | GPIO pin connected to the I2C SDA line (default: GPIO 12) |
| sclpin | GPIO pin connected to the I2C SCL line (default: GPIO 13) |
| void LightSensor::begin | ( | ) |
Initialize the VEML6030 light sensor.
Configures the sensor with default parameters:
| uint32_t LightSensor::readLight | ( | ) |
Read the current light level in lux.
| void LightSensor::stop | ( | ) |
Stop the sensor.
Powers down the sensor to save energy. The sensor will not respond to read commands until re-initialized.