-
Notifications
You must be signed in to change notification settings - Fork 2
getProximity()
This function retrieves the most recent proximity sensor reading from the VCNL4010. The library is set up to start a new sampling directly after reading the previous value, which saves microseconds sampling time on each call. When continuous sampling is enabled using the SetProximityContinuous() function the most recent value is returned while the device continues sampling in the background.
The value is an unsigned integer which ranges from around 2200 when no object is reflecting to 65535 when an object is touching the sensor.
VCNL4010 Sensor(); // Instantiate class
...
while (!Sensor.begin()); // Initialize the VCNL4010
uint16_t currentValue = Sensor.getProximity(); // Retrieve most recent value
Serial.print("Proximity sensor value is "); // Show message
Serial.println(currentValue); // Show value
Overview
Installation
Class Instantiation
begin()
setProximityHz()
setLEDmA()
setProximityFreq()
setAmbientLight()
setAmbientContinuous()
setProximityContinuous()
setInterrupt()
getAmbientLight()
getProximity()
getInterrupt()
clearInterrupt()
readByte() (advanced)
readWord() (advanced)
writeByte() (advanced)
-none-
CheckDistance.ino
DisplayMeasurements.ino
RegressionTests.ino
WakeOnInterrupt.ino