Remarks

ALS-PT19-315C
Status
Source code GitHub
NuGet package

The ALS-PT19-315C is a low cost analog ambient light sensor, consisting of phototransistor in a miniature SMD.

Code Example

public class MeadowApp : App<F7Micro, MeadowApp>
{
    Alspt19315C sensor;

    public MeadowApp()
    {
        Init();

        Task.Run(async () =>
        {
            while(true)
            {
                Console.WriteLine($"Relative light intensity: {await sensor.GetVoltage()}");
                await Task.Delay(500);
            }
        });
    }

    public void Init()
    {
        Console.WriteLine("Init...");

        sensor = new Alspt19315C(Device, Device.Pins.A01);
    }
}

Sample projects available on GitHub

Purchasing

The ALS-PT19 senors are available on breakout boards and as individual sensors:

Circuit Example

The ALS-PT19C is a simple analog device requiring only three connections:

Characteristic Locus
Inheritance System.Object > Alspt19315C
Inherited Members System.Object.ToString() System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.ReferenceEquals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone()
Namespace Meadow.Foundation.Sensors.Light
Assembly Alspt19315C.dll

Syntax

public class Alspt19315C

Constructors

Alspt19315C(IIODevice, IPin)

Create a new light sensor object using a static reference voltage.

Declaration
public Alspt19315C(IIODevice device, IPin pin)

Parameters

Type Name Description
IIODevice device
IPin pin

AnalogChannel connected to the sensor.

Methods

GetVoltage()

Voltage being output by the sensor.

Declaration
public Task<float> GetVoltage()

Returns

Type Description
System.Threading.Tasks.Task<System.Single>