Simple test

Ensure your device works with this simple test.

examples/vcnl4040_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
import time
import board
import busio
import adafruit_vcnl4040

i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_vcnl4040.VCNL4040(i2c)

while True:
    print("Proximity:", sensor.proximity)
    print("Light: %d lux"% sensor.lux)
    time.sleep(1.0)