Adafruit VEML6075 UV Sensor Library
Public Member Functions | Public Attributes | List of all members
Adafruit_VEML6075 Class Reference

Class that stores state and functions for interacting with VEML6075 sensor IC. More...

#include <Adafruit_VEML6075.h>

Public Member Functions

 Adafruit_VEML6075 ()
 constructor initializes default configuration value
 
boolean begin (veml6075_integrationtime_t itime=VEML6075_100MS, bool highDynamic=false, bool forcedReads=false, TwoWire *theWire=&Wire)
 setup and initialize communication with the hardware More...
 
void shutdown (bool sd)
 Shut down the sensor. More...
 
void setIntegrationTime (veml6075_integrationtime_t itime)
 Set the time over which we sample UV data per read. More...
 
veml6075_integrationtime_t getIntegrationTime (void)
 Get the time over which we sample UV data per read from the sensor. More...
 
void setHighDynamic (bool hd)
 Sets whether to take readings in 'high dynamic' mode. More...
 
bool getHighDynamic (void)
 Gets whether to take readings in 'high dynamic' mode. More...
 
void setForcedMode (bool flag)
 Sets whether to take readings on request. More...
 
bool getForcedMode (void)
 Gets whether to take readings on request. More...
 
void setCoefficients (float UVA_A, float UVA_B, float UVA_C, float UVA_D, float UVA_response, float UVB_response)
 Set the UVI calculation coefficients, see datasheet for some example values. We use the default "no cover glass" values if none are specified when initializing the sensor. More...
 
float readUVA (void)
 read the calibrated UVA band reading More...
 
float readUVB (void)
 read the calibrated UVB band reading More...
 
float readUVI (void)
 Read and calculate the approximate UV Index reading. More...
 
void readUVABI (float *a, float *b, float *i)
 read the calibrated UVA & UVB band reading and calculate the approximate UV Index reading More...
 

Public Attributes

Adafruit_I2CRegister * Config_Register
 Chip config register.
 

Detailed Description

Class that stores state and functions for interacting with VEML6075 sensor IC.

Member Function Documentation

◆ begin()

boolean Adafruit_VEML6075::begin ( veml6075_integrationtime_t  itime = VEML6075_100MS,
bool  highDynamic = false,
bool  forcedReads = false,
TwoWire *  theWire = &Wire 
)

setup and initialize communication with the hardware

Parameters
itimeThe integration time to use for the data. Defaults to 100ms
forcedReadsTrue for triggered read, false for continuous (default)
highDynamicWhether to read in normal or high dynamic mode - defaults to normal
theWireOptional pointer to the desired TwoWire I2C object. Defaults to &Wire
Returns
True if sensor found, false if sensor not detected

◆ shutdown()

void Adafruit_VEML6075::shutdown ( bool  sd)

Shut down the sensor.

Parameters
sdTrue if you want to shut down, false to enable

◆ setIntegrationTime()

void Adafruit_VEML6075::setIntegrationTime ( veml6075_integrationtime_t  itime)

Set the time over which we sample UV data per read.

Parameters
itimeHow many milliseconds to integrate over

◆ getIntegrationTime()

veml6075_integrationtime_t Adafruit_VEML6075::getIntegrationTime ( void  )

Get the time over which we sample UV data per read from the sensor.

Returns
How many milliseconds to integrate over

◆ setHighDynamic()

void Adafruit_VEML6075::setHighDynamic ( bool  hd)

Sets whether to take readings in 'high dynamic' mode.

Parameters
hdTrue if you want high dynamic readings, False for normal dynamic

◆ getHighDynamic()

bool Adafruit_VEML6075::getHighDynamic ( void  )

Gets whether to take readings in 'high dynamic' mode.

Returns
True if set to high dynamic readings, False for normal dynamic

◆ setForcedMode()

void Adafruit_VEML6075::setForcedMode ( bool  flag)

Sets whether to take readings on request.

Parameters
flagTrue if you want readings on request, False for continuous reads

◆ getForcedMode()

bool Adafruit_VEML6075::getForcedMode ( void  )

Gets whether to take readings on request.

Returns
True if readings on request, False for continuous reads

◆ setCoefficients()

void Adafruit_VEML6075::setCoefficients ( float  UVA_A,
float  UVA_B,
float  UVB_C,
float  UVB_D,
float  UVA_response,
float  UVB_response 
)

Set the UVI calculation coefficients, see datasheet for some example values. We use the default "no cover glass" values if none are specified when initializing the sensor.

Parameters
UVA_Athe UVA visible coefficient
UVA_Bthe UVA IR coefficient
UVB_Cthe UVB visible coefficient
UVB_Dthe UVB IR coefficient
UVA_responsethe UVA responsivity
UVB_responsethe UVB responsivity

◆ readUVA()

float Adafruit_VEML6075::readUVA ( void  )

read the calibrated UVA band reading

Returns
the UVA reading in unitless counts or NAN if reading failed

◆ readUVB()

float Adafruit_VEML6075::readUVB ( void  )

read the calibrated UVB band reading

Returns
the UVB reading in unitless counts or NAN if reading failed

◆ readUVI()

float Adafruit_VEML6075::readUVI ( void  )

Read and calculate the approximate UV Index reading.

Returns
the UV Index as a floating point or NAN if reading failed

◆ readUVABI()

void Adafruit_VEML6075::readUVABI ( float *  a,
float *  b,
float *  i 
)

read the calibrated UVA & UVB band reading and calculate the approximate UV Index reading

Parameters
apointer to store UVA reading or NAN if reading failed
bpointer to store UVB reading or NAN if reading failed
ipointer to store UVI reading or NAN if reading failed

The documentation for this class was generated from the following files: