public void Run(IBackgroundTaskInstance taskInstance) { using (ExplorerHatPro hat = new ExplorerHatPro(ADS1015.Gain.Volt5)) using (BMP280 bmp280 = new BMP280(0x76)) { while (true) { Debug.WriteLine($"Temperature {bmp280.Temperature.DegreesCelsius}C, Pressure {bmp280.Pressure.Hectopascals}, Light ratio {hat.AnalogRead(AnalogPin.Ain2).ReadRatio()} "); for (int l = 0; l < hat.ColourCount; l++) { hat.Light((Colour)l).On(); Task.Delay(20).Wait(); } for (int l = 0; l < hat.ColourCount; l++) { hat.Light((Colour)l).Off(); Task.Delay(20).Wait(); } } } }