Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (32 sloc) 982 Bytes

Grove LightSensor modules

Version: 1.0.0-preview3

Connections

Grove LightSensor is connected as followed on Netduino3:

Schematic

Grove LightSensor Mainboard with base shield
Yellow wire Socket D6

Example of code:

using System.Diagnostics;
using System.Threading;
using Bauland.Grove;
using Bauland.Pins;

namespace TestLightSensor
{
    static class Program
    {
        static void Main()
        {
            // Grove LightSensor is onnected on A0 pin of Netduino3 board.
            LightSensor lightSensor=new LightSensor(Netduino3.AdcChannel.A0);
            while (true)
            {
                Debug.WriteLine("Light level: "+lightSensor.ReadPercentageLightLevel()+"%.");
                Thread.Sleep(1000);
            }
            // ReSharper disable once FunctionNeverReturns
        }
    }
}