Remarks

Veml7700
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Sensors.Light.Veml7700

The TEMT6000 is an I2C ambient light sensor.

Code Example

Veml7700 sensor;

public override Task Initialize()
{
    Console.WriteLine("Initialize...");

    sensor = new Veml7700(Device.CreateI2cBus());
    sensor.DataSource = Veml7700.SensorTypes.Ambient;

    sensor.RangeExceededHigh += (s, a) => Console.WriteLine("Too bright to measure");
    sensor.RangeExceededLow += (s, a) => Console.WriteLine("Too dim to measure");

    // classical .NET events can also be used:
    sensor.Updated += (sender, result) => Console.WriteLine($"Illuminance: {result.New.Lux:n3}Lux");

    return Task.CompletedTask;
}

public override async Task Run()
{
    var conditions = await sensor.Read();

    Console.WriteLine("Initial Readings:");
    Console.WriteLine($"  Illuminance: {conditions.Lux:n3}Lux");

    sensor.StartUpdating(TimeSpan.FromSeconds(1));
}

Sample project(s) available on GitHub

Wiring Example

To wire a Veml7700 to your Meadow board, connect the following:

Veml7700 Meadow Pin
3V3 3V3
GND GND
SCK D08
SDA D07

It should look like the following diagram:

Characteristic Locus
Inheritance System.Object ObservableBase<Illuminance> SensorBase<Illuminance> SamplingSensorBase<Illuminance> ByteCommsSensorBase<Illuminance> > Veml7700
Implements IDisposable ILightSensor IDisposable
Inherited Members ByteCommsSensorBase<Illuminance>.Peripheral ByteCommsSensorBase<Illuminance>.ReadBuffer ByteCommsSensorBase<Illuminance>.WriteBuffer ByteCommsSensorBase<Illuminance>.Init(Int32, Int32) ByteCommsSensorBase<Illuminance>.Dispose(Boolean) ByteCommsSensorBase<Illuminance>.Dispose() SamplingSensorBase<Illuminance>.StartUpdating(Nullable<TimeSpan>) SamplingSensorBase<Illuminance>.StopUpdating() SensorBase<Illuminance>.Updated SensorBase<Illuminance>.samplingLock SensorBase<Illuminance>.SamplingTokenSource SensorBase<Illuminance>.Conditions SensorBase<Illuminance>.IsSampling SensorBase<Illuminance>.UpdateInterval SensorBase<Illuminance>.RaiseEventsAndNotify(IChangeResult<>) SensorBase<Illuminance>.Read() ObservableBase<Illuminance>.observers ObservableBase<Illuminance>.NotifyObservers(IChangeResult<>) Meadow.Foundation.ObservableBase<Illuminance>.Subscribe(IObserver<>) Meadow.Foundation.ObservableBase<Illuminance>.CreateObserver(Action<>, System.Nullable<Predicate<IChangeResult<UNIT>>>)
Namespace Meadow.Foundation.Sensors.Light
Assembly Veml7700.dll

Syntax

public class Veml7700 : ByteCommsSensorBase<Illuminance>, IDisposable, ILightSensor, IDisposable

Constructors

Veml7700(II2cBus)

Declaration
public Veml7700(II2cBus i2cBus)

Parameters

Type Name Description
II2cBus i2cBus

Properties

DataSource

Declaration
public Veml7700.SensorTypes DataSource { get; set; }

Property Value

Type Description
Veml7700.SensorTypes

Illuminance

Luminosity reading from the TSL2561 sensor.

Declaration
public Illuminance? Illuminance { get; protected set; }

Property Value

Type Description
System.Nullable<Illuminance>

Methods

RaiseEventsAndNotify(IChangeResult<Illuminance>)

Declaration
protected override void RaiseEventsAndNotify(IChangeResult<Illuminance> changeResult)

Parameters

Type Name Description
IChangeResult<Illuminance> changeResult

ReadSensor()

Declaration
protected override Task<Illuminance> ReadSensor()

Returns

Type Description
Task<Illuminance>

Overrides

Meadow.Foundation.SensorBase<Illuminance>.ReadSensor()

Events

LuminosityUpdated

Declaration
public event EventHandler<IChangeResult<Illuminance>> LuminosityUpdated

Event Type

Type Description
EventHandler<IChangeResult<Illuminance>>

RangeExceededHigh

Declaration
public event EventHandler RangeExceededHigh

Event Type

Type Description
EventHandler

RangeExceededLow

Declaration
public event EventHandler RangeExceededLow

Event Type

Type Description
EventHandler