nanoFramework.Iot.Device.Vcnl4040
1.0.1
Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Vcnl4040 --version 1.0.1
NuGet\Install-Package nanoFramework.Iot.Device.Vcnl4040 -Version 1.0.1
<PackageReference Include="nanoFramework.Iot.Device.Vcnl4040" Version="1.0.1" />
<PackageVersion Include="nanoFramework.Iot.Device.Vcnl4040" Version="1.0.1" />
<PackageReference Include="nanoFramework.Iot.Device.Vcnl4040" />
paket add nanoFramework.Iot.Device.Vcnl4040 --version 1.0.1
#r "nuget: nanoFramework.Iot.Device.Vcnl4040, 1.0.1"
#:package nanoFramework.Iot.Device.Vcnl4040@1.0.1
#addin nuget:?package=nanoFramework.Iot.Device.Vcnl4040&version=1.0.1
#tool nuget:?package=nanoFramework.Iot.Device.Vcnl4040&version=1.0.1
VCNL4040 - Proximity and Ambient Light Sensor
The VCNL4040 combines a proximity sensor, infrared emitter, ambient light sensor, and white-light channel. The binding supports sensor power control, emitter and receiver configuration, measurements, threshold interrupts, and interrupt flags. Its fixed I2C address is 0x60.
Documentation
Wiring
| VCNL4040 | ESP32 |
|---|---|
| VIN | 3.3 V |
| GND | GND |
| SDA | GPIO21 |
| SCL | GPIO22 |
| INT | Any input GPIO (optional) |
Configure ESP32 I2C pins before creating the device. Other targets use their board-specific I2C pins.
Usage
Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);
I2cConnectionSettings settings = new I2cConnectionSettings(1, Vcnl4040Device.DefaultI2cAddress);
using I2cDevice i2cDevice = I2cDevice.Create(settings);
using Vcnl4040Device sensor = new Vcnl4040Device(i2cDevice);
sensor.AmbientLightSensor.IntegrationTime = AlsIntegrationTime.Time160ms;
sensor.AmbientLightSensor.PowerOn = true;
sensor.ProximitySensor.PowerOn = true;
while (true)
{
Debug.WriteLine($"Illuminance: {sensor.AmbientLightSensor.Illuminance.Lux:F2} lux");
Debug.WriteLine($"Proximity reading: {sensor.ProximitySensor.Distance} counts");
Thread.Sleep(1000);
}
The proximity reading is an uncalibrated reflection count, not a physical distance. Its relationship to distance depends on the target surface, emitter settings, optical layout, and receiver configuration.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net is compatible. |
-
- nanoFramework.CoreLibrary (>= 1.17.11)
- nanoFramework.System.Device.I2c (>= 1.1.29)
- nanoFramework.UnitsNet.Illuminance (>= 5.76.15)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 85 | 9/29/2026 |