Skip to content

Class Instantiation

Arnd edited this page Dec 11, 2020 · 2 revisions

VCNL4010();

The VCNL4010 class instantiation has no parameters required for instantiation. The I2C device address for the device is hard-coded and cannot be changed. The device itself isn't initialized until the begin() method is called.


Example:

VCNL4010 Sensor();  // Instantiate class    
...    
while (!Sensor.begin()) {                                        // Loop until sensor found
  Serial.println("Error, unable to find or identify VCNL4010."); // Show error message
  delay(5000);                                                   // Wait 5 seconds before retrying
} // of if-then we can't initialize or find the device

Clone this wiki locally