Last active
April 1, 2022 13:32
-
-
Save baskaufs/6bf8c967df0c9312b06e4a4458d585bb to your computer and use it in GitHub Desktop.
CircuitPython code to use with VCNL 4040 proximity and lux sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import board | |
import busio | |
import adafruit_vcnl4040 | |
i2c = busio.I2C(board.SCL1, board.SDA1) | |
sensor = adafruit_vcnl4040.VCNL4040(i2c) | |
while True: | |
print("Proximity:", sensor.proximity) | |
print("Light: %d lux" % sensor.lux) | |
# Use the following line for the plotter function | |
#print( (sensor.lux,) ) # Force the data to be represented as a 1=tuple | |
time.sleep(1.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment