Remarks

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

The TEMT6000 is an analog ambient light sensor.

Code Example

Temt6000 sensor;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    // configure our sensor
    sensor = new Temt6000(Device.Pins.A03);

    // Example that uses an IObservable subscription to only be notified when the voltage changes by at least 0.5V
    var consumer = Temt6000.CreateObserver(
        handler: result => Resolver.Log.Info($"Observer filter satisfied: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V"),
        // only notify if the change is greater than 0.5V
        filter: result =>
        {
            if (result.Old is { } old)
            {
                return (result.New - old).Abs().Volts > 0.5; // returns true if > 0.5V change.
            }
            return false;
        });

    sensor.Subscribe(consumer);

    // classical .NET events can also be used:
    sensor.Updated += (sender, result) =>
    {
        Resolver.Log.Info($"Voltage Changed, new: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var result = await sensor.Read();
    Resolver.Log.Info($"Initial temp: {result.Volts:N2}V");

    sensor.StartUpdating(TimeSpan.FromMilliseconds(1000));
}

Sample project(s) available on GitHub

Wiring Example

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

Temt6000 Meadow Pin
GND GND
SIG A03
VCC 3V3

It should look like the following diagram:

Characteristic Locus
Inheritance object ObservableBase<Voltage> SamplingSensorBase<Voltage> AnalogSamplingBase > Temt6000
Implements IObservable<IChangeResult<Voltage>> ISamplingSensor<Voltage> ISensor<Voltage> IDisposable
Inherited Members AnalogSamplingBase.Voltage AnalogSamplingBase.StartUpdating(TimeSpan?) AnalogSamplingBase.StopUpdating() AnalogSamplingBase.ReadSensor() SamplingSensorBase<Voltage>.samplingLock SamplingSensorBase<Voltage>.Updated SamplingSensorBase<Voltage>.SamplingTokenSource SamplingSensorBase<Voltage>.Conditions SamplingSensorBase<Voltage>.IsSampling SamplingSensorBase<Voltage>.UpdateInterval SamplingSensorBase<Voltage>.RaiseEventsAndNotify(IChangeResult<Voltage>) SamplingSensorBase<Voltage>.Read() ObservableBase<Voltage>.observers ObservableBase<Voltage>.NotifyObservers(IChangeResult<Voltage>) ObservableBase<Voltage>.Subscribe(IObserver<IChangeResult<Voltage>>) ObservableBase<Voltage>.CreateObserver(Action<IChangeResult<Voltage>>, Predicate<IChangeResult<Voltage>>) object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Sensors.Light
Assembly Temt6000.dll

Syntax

public class Temt6000 : AnalogSamplingBase, IObservable<IChangeResult<Voltage>>, ISamplingSensor<Voltage>, ISensor<Voltage>, IDisposable

Constructors

Temt6000(IAnalogInputPort)

Creates a new Temt6000 driver

Declaration
public Temt6000(IAnalogInputPort port)

Parameters

Type Name Description
IAnalogInputPort port

Remarks

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

The TEMT6000 is an analog ambient light sensor.

Code Example

Temt6000 sensor;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    // configure our sensor
    sensor = new Temt6000(Device.Pins.A03);

    // Example that uses an IObservable subscription to only be notified when the voltage changes by at least 0.5V
    var consumer = Temt6000.CreateObserver(
        handler: result => Resolver.Log.Info($"Observer filter satisfied: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V"),
        // only notify if the change is greater than 0.5V
        filter: result =>
        {
            if (result.Old is { } old)
            {
                return (result.New - old).Abs().Volts > 0.5; // returns true if > 0.5V change.
            }
            return false;
        });

    sensor.Subscribe(consumer);

    // classical .NET events can also be used:
    sensor.Updated += (sender, result) =>
    {
        Resolver.Log.Info($"Voltage Changed, new: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var result = await sensor.Read();
    Resolver.Log.Info($"Initial temp: {result.Volts:N2}V");

    sensor.StartUpdating(TimeSpan.FromMilliseconds(1000));
}

Sample project(s) available on GitHub

Wiring Example

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

Temt6000 Meadow Pin
GND GND
SIG A03
VCC 3V3

It should look like the following diagram:

Temt6000(IPin, int, TimeSpan?, Voltage?)

Creates a new Temt6000 object

Declaration
public Temt6000(IPin pin, int sampleCount = 5, TimeSpan? sampleInterval = null, Voltage? voltage = null)

Parameters

Type Name Description
IPin pin

The analog pin

int sampleCount

The sample count

TimeSpan? sampleInterval

The sample interval

Voltage? voltage

The peak voltage

Remarks

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

The TEMT6000 is an analog ambient light sensor.

Code Example

Temt6000 sensor;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    // configure our sensor
    sensor = new Temt6000(Device.Pins.A03);

    // Example that uses an IObservable subscription to only be notified when the voltage changes by at least 0.5V
    var consumer = Temt6000.CreateObserver(
        handler: result => Resolver.Log.Info($"Observer filter satisfied: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V"),
        // only notify if the change is greater than 0.5V
        filter: result =>
        {
            if (result.Old is { } old)
            {
                return (result.New - old).Abs().Volts > 0.5; // returns true if > 0.5V change.
            }
            return false;
        });

    sensor.Subscribe(consumer);

    // classical .NET events can also be used:
    sensor.Updated += (sender, result) =>
    {
        Resolver.Log.Info($"Voltage Changed, new: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var result = await sensor.Read();
    Resolver.Log.Info($"Initial temp: {result.Volts:N2}V");

    sensor.StartUpdating(TimeSpan.FromMilliseconds(1000));
}

Sample project(s) available on GitHub

Wiring Example

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

Temt6000 Meadow Pin
GND GND
SIG A03
VCC 3V3

It should look like the following diagram:

Properties

IsDisposed

Is the object disposed

Declaration
public bool IsDisposed { get; }

Property Value

Type Description
bool

Remarks

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

The TEMT6000 is an analog ambient light sensor.

Code Example

Temt6000 sensor;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    // configure our sensor
    sensor = new Temt6000(Device.Pins.A03);

    // Example that uses an IObservable subscription to only be notified when the voltage changes by at least 0.5V
    var consumer = Temt6000.CreateObserver(
        handler: result => Resolver.Log.Info($"Observer filter satisfied: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V"),
        // only notify if the change is greater than 0.5V
        filter: result =>
        {
            if (result.Old is { } old)
            {
                return (result.New - old).Abs().Volts > 0.5; // returns true if > 0.5V change.
            }
            return false;
        });

    sensor.Subscribe(consumer);

    // classical .NET events can also be used:
    sensor.Updated += (sender, result) =>
    {
        Resolver.Log.Info($"Voltage Changed, new: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var result = await sensor.Read();
    Resolver.Log.Info($"Initial temp: {result.Volts:N2}V");

    sensor.StartUpdating(TimeSpan.FromMilliseconds(1000));
}

Sample project(s) available on GitHub

Wiring Example

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

Temt6000 Meadow Pin
GND GND
SIG A03
VCC 3V3

It should look like the following diagram:

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()

Remarks

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

The TEMT6000 is an analog ambient light sensor.

Code Example

Temt6000 sensor;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    // configure our sensor
    sensor = new Temt6000(Device.Pins.A03);

    // Example that uses an IObservable subscription to only be notified when the voltage changes by at least 0.5V
    var consumer = Temt6000.CreateObserver(
        handler: result => Resolver.Log.Info($"Observer filter satisfied: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V"),
        // only notify if the change is greater than 0.5V
        filter: result =>
        {
            if (result.Old is { } old)
            {
                return (result.New - old).Abs().Volts > 0.5; // returns true if > 0.5V change.
            }
            return false;
        });

    sensor.Subscribe(consumer);

    // classical .NET events can also be used:
    sensor.Updated += (sender, result) =>
    {
        Resolver.Log.Info($"Voltage Changed, new: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var result = await sensor.Read();
    Resolver.Log.Info($"Initial temp: {result.Volts:N2}V");

    sensor.StartUpdating(TimeSpan.FromMilliseconds(1000));
}

Sample project(s) available on GitHub

Wiring Example

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

Temt6000 Meadow Pin
GND GND
SIG A03
VCC 3V3

It should look like the following diagram:

Dispose(bool)

Dispose of the object

Declaration
protected virtual void Dispose(bool disposing)

Parameters

Type Name Description
bool disposing

Is disposing

Remarks

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

The TEMT6000 is an analog ambient light sensor.

Code Example

Temt6000 sensor;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    // configure our sensor
    sensor = new Temt6000(Device.Pins.A03);

    // Example that uses an IObservable subscription to only be notified when the voltage changes by at least 0.5V
    var consumer = Temt6000.CreateObserver(
        handler: result => Resolver.Log.Info($"Observer filter satisfied: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V"),
        // only notify if the change is greater than 0.5V
        filter: result =>
        {
            if (result.Old is { } old)
            {
                return (result.New - old).Abs().Volts > 0.5; // returns true if > 0.5V change.
            }
            return false;
        });

    sensor.Subscribe(consumer);

    // classical .NET events can also be used:
    sensor.Updated += (sender, result) =>
    {
        Resolver.Log.Info($"Voltage Changed, new: {result.New.Volts:N2}V, old: {result.Old?.Volts:N2}V");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var result = await sensor.Read();
    Resolver.Log.Info($"Initial temp: {result.Volts:N2}V");

    sensor.StartUpdating(TimeSpan.FromMilliseconds(1000));
}

Sample project(s) available on GitHub

Wiring Example

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

Temt6000 Meadow Pin
GND GND
SIG A03
VCC 3V3

It should look like the following diagram: