Skip to content

readWord()

Arnd edited this page Dec 25, 2020 · 1 revision

readWord(address)

This function is used to communicate directly with the VCNL4010 and read a word (2 bytes) from a specific address. It is exposed as a public function call, but all of the normal functionality of the VCNL4010 is accessible via the other calls in the library and this function is not normally required.

It is intended for advanced use where calls to I2C are to be made directly.


Example:

VCNL4010 Sensor();      // Instantiate class    
...    
while(!Sensor.begin()); // loop until initialized
uint16_t returnValue = readWord(VCNL4010_AMBIENT_LIGHT_REG); 
Serial.print("The raw value of the Ambient light register is ");
Serial.print(returnValue);
Serial.println(".");