Adafruit VCNL4010 Library
Public Member Functions | List of all members
Adafruit_VCNL4010 Class Reference

Public Member Functions

 Adafruit_VCNL4010 ()
 Instantiates a new VCNL4010 class.
 
boolean begin (uint8_t a=VCNL4010_I2CADDR_DEFAULT)
 Setups the I2C connection and tests that the sensor was found. If so, configures for 200mA IR current and 390.625 KHz. More...
 
uint8_t getLEDcurrent (void)
 Get the LED current. More...
 
void setLEDcurrent (uint8_t c)
 Set the LED current. More...
 
void setFrequency (vcnl4010_freq f)
 Set the measurement signal frequency. More...
 
uint16_t readProximity (void)
 Get proximity measurement. More...
 
uint16_t readAmbient (void)
 Get ambient light measurement. More...
 

Member Function Documentation

◆ begin()

boolean Adafruit_VCNL4010::begin ( uint8_t  addr = VCNL4010_I2CADDR_DEFAULT)

Setups the I2C connection and tests that the sensor was found. If so, configures for 200mA IR current and 390.625 KHz.

Parameters
addrOptional I2C address (however, all chips have the same address!)
Returns
true if sensor was found, false if not

◆ getLEDcurrent()

uint8_t Adafruit_VCNL4010::getLEDcurrent ( void  )

Get the LED current.

Returns
The value directly from the register. Each bit represents 10mA so 5 == 50mA

◆ setLEDcurrent()

void Adafruit_VCNL4010::setLEDcurrent ( uint8_t  current_10mA)

Set the LED current.

Parameters
current_10mACan be any value from 0 to 20, each number represents 10 mA, so if you set it to 5, its 50mA. Minimum is 0 (0 mA, off), max is 20 (200mA)

◆ setFrequency()

void Adafruit_VCNL4010::setFrequency ( vcnl4010_freq  freq)

Set the measurement signal frequency.

Parameters
freqSets the measurement rate for proximity. Can be VCNL4010_1_95 (1.95 measurements/s), VCNL4010_3_90625 (3.9062 meas/s), VCNL4010_7_8125 (7.8125 meas/s), VCNL4010_16_625 (16.625 meas/s), VCNL4010_31_25 (31.25 meas/s), VCNL4010_62_5 (62.5 meas/s), VCNL4010_125 (125 meas/s) or VCNL4010_250 (250 measurements/s)

◆ readProximity()

uint16_t Adafruit_VCNL4010::readProximity ( void  )

Get proximity measurement.

Returns
Raw 16-bit reading value, will vary with LED current, unit-less!

◆ readAmbient()

uint16_t Adafruit_VCNL4010::readAmbient ( void  )

Get ambient light measurement.

Returns
Raw 16-bit reading value, unit-less!

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