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

Remarks

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

Purchasing

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

Examples

The following application reads the sensor output voltage once per second and outputs the result on the output console:

using System.Threading;
using Meadow;
using Meadow.Foundation.Sensors.Light;

namespace ALSPT19315C_Sample
{
    public class Program
    {
        static IApp _app; 
        public static void Main()
        {
            _app = new App();
        }
    }

    public class App : AppBase<F7Micro, App>
    {
        public App ()
        {
            Console.WriteLine("ALSPT19315C Test");
            var sensor = new ALSPT19315C(Cpu.AnalogChannel.ANALOG_1, 3.3);

            while (true)
            {
                Console.WriteLine("Sensor reading: " + sensor.Voltage.ToString("f2"));
                Thread.Sleep(1000);
            }
        }
    }
}
Example Circuit

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

Constructors

View Source

ALSPT19315C(IIODevice, IPin, IPin)

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

Declaration
public ALSPT19315C(IIODevice device, IPin pin, IPin referenceVoltagePin)

Parameters

Type Name Description
IIODevice device
IPin pin

Analog channel connected to the sensor.

IPin referenceVoltagePin

Analog channel connected to the reference voltage souce.

View Source

ALSPT19315C(IIODevice, IPin, Double)

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

Declaration
public ALSPT19315C(IIODevice device, IPin pin, double referenceVoltage)

Parameters

Type Name Description
IIODevice device
IPin pin

AnalogChannel connected to the sensor.

System.Double referenceVoltage

Reference voltage.

Methods

View Source

GetVoltage()

Voltage being output by the sensor.

Declaration
public double GetVoltage()

Returns

Type Description
System.Double