Skip to content

setProximityHz()

Arnd edited this page Jan 1, 2017 · 2 revisions

SetProximityHz([Hertz])

Proximity is measured with an IR transmitter and receiver on the VCNL4010. This function accepts an unsigned integer number representing the Hertz rate used to scan. The number entered is set to the closest actual internal setting which ranges from the default 1.95 measurements per second up to 250 measurements per second. The following table lists the discrete values used by the VCNL4010:

Binary
Value
Measurement frequency
000 1.95 measurements/s
001 3.90625 measurements/s
010 7.8125 measurements/s
011 16.625 measurements/s
100 31.25 measurements/s
101 62.5 measurements/s
110 125 measurements/s
111 250 measurements/s

Example:

VCNL4010 Sensor();          // Instantiate class    
...    
while(!Sensor.begin());     // loop until initialized
Sensor.setProximityHz(230); // gets rounded down to 125Hz