-
Notifications
You must be signed in to change notification settings - Fork 2
setInterrupt()
setInterrupt([Count][,ProximityReady][,ALSReady][,ProxThreshold][,ALSThreshold][,lowValue][,highValue])
This function allows the use of the interrupt output of the VCNL4010. By default this pin is pulled high but when an interrupt is triggered by the events set by this call the pin is pulled low and this can be used on the Arduino to set a pin change interrupt which can be very useful. One example is to set an interrupt when the proximity sensor detects movement and keep the processor into energy-saving state.
The parameters are as follow:
Name | Type | Default | Description |
---|---|---|---|
Count | uint8 | 1 | The number of events needed to trigger an interrupt |
Proximity Ready | boolean | false | Whether or not to trigger an interrupt when a proximity reading is ready |
ALS Ready | boolean | false | Whether or not to trigger an interrupt when an ambient light sensor reading is ready |
Proximity Threshold | boolean | false | When true, use the low and high threshold numbers for proximity readings and trigger an interrupt when either threshold has been exceeded |
ALS Threshold | boolean | false | When true, use the low and high threshold numbers for ambient light sensor readings and trigger an interrupt when either threshold has been exceeded |
Low Threshold value | uint16 | 0 | The low threshold value, when a reading is lower than this value an interrupt is set |
High Threshold value | uint16 | 65536 | The high threshold value, when a reading is higher than this value an interrupt is set |
Once an interrupt has been raised and the pin pulled down, the condition remains until explicitly cleared by the user using the clearInterrupt() function.
VCNL4010 Sensor(); // Instantiate class
...
while(!Sensor.begin()); // loop until initialized
Sensor.setInterrupt(1,false,false,false,true,500,32000);
// Trigger an interrupt when the proximity reads below 500 or over 32000 //
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