Introduction
A CircuitPython library for the VCNL4040 proximity and ambient light sensor.
Dependencies
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
Installing from PyPI
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install adafruit-circuitpython-vcnl4040
To install system-wide (this may be required in some cases):
sudo pip3 install adafruit-circuitpython-vcnl4040
To install in a virtual environment in your current project:
mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-vcnl4040
Usage Example
import time
import board
import adafruit_vcnl4040
i2c = board.I2C()
sensor = adafruit_vcnl4040.VCNL4040(i2c)
while True:
print("Proximity:", sensor.proximity)
print("Light:", sensor.light)
print("White:", sensor.white)
time.sleep(0.3)
Documentation
API documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Table of Contents
adafruit_vcnl4040
VCNL4040
VCNL4040.led_current
VCNL4040.led_duty_cycle
VCNL4040.light
VCNL4040.light_high_interrupt
VCNL4040.light_high_threshold
VCNL4040.light_integration_time
VCNL4040.light_interrupt
VCNL4040.light_low_interrupt
VCNL4040.light_low_threshold
VCNL4040.light_shutdown
VCNL4040.lux
VCNL4040.proximity
VCNL4040.proximity_bits
VCNL4040.proximity_high_interrupt
VCNL4040.proximity_high_threshold
VCNL4040.proximity_integration_time
VCNL4040.proximity_interrupt
VCNL4040.proximity_low_interrupt
VCNL4040.proximity_low_threshold
VCNL4040.proximity_shutdown
VCNL4040.white
VCNL4040.white_shutdown