Accessing Ambient Light Sensor on Microsoft Band

前端 未结 4 1219
时光说笑
时光说笑 2021-02-04 22:16

There is an Ambient Light Sensor with Microsoft Band, and some apps in the Windows Store show the ALS value in Lux, But I can\'t find a way in the Band SDK to read the ALS Lux v

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-04 22:55

    the Microsoft Band SDK (NuGet package v1.3.11121) now exposes the ambient light sensor.

    if (bandClient.SensorManager.AmbientLight.IsSupported)
    {
        bandClient.SensorManager.AmbientLight.ReadingChanged += (s, args) =>
        {
            Debug.WriteLine(bandClient.SensorManager.AmbientLight.Brightness);
        };
        await bandClient.SensorManager.AmbientLight.StartReadingsAsync();
        await Task.Delay(TimeSpan.FromSeconds(5));
        await bandClient.SensorManager.AmbientLight.StopReadingsAsync();
    }
    

提交回复
热议问题