Apds9960 sensor;
public MeadowApp()
{
Console.WriteLine("Initializing...");
var i2c = Device.CreateI2cBus();
sensor = new Apds9960(Device, i2c, Device.Pins.D00);
sensor.Updated += (sender, result) => {
Console.WriteLine($" Ambient Light: {result.New.AmbientLight?.Lux:N2}Lux");
Console.WriteLine($" Color: {result.New.Color:N2}Lux");
};
sensor.EnableLightSensor(false);
ReadConditions().Wait();
sensor.StartUpdating(TimeSpan.FromSeconds(1));
}
protected async Task ReadConditions()
{
var result = await sensor.Read();
Console.WriteLine("Initial Readings:");
Console.WriteLine($" Ambient Light: {result.AmbientLight?.Lux:N2}Lux");
Console.WriteLine($" Color: {result.Color:N2}Lux");
}