Пример #1
0
        private void TimerCallback(object state)
        {
            var temp     = bme280.ReadTemperature();
            var press    = bme280.ReadPreasure() / 100;
            var humidity = bme280.ReadHumidity();
            var alt      = bme280.ReadAltitude(1013); // 1013hPa = pressure at 0m

            Debug.WriteLine("Temp:{0:F2}℃ Humidity:{1:F2}% Press:{2:F2}hPa Alt:{3:F0}m", temp, humidity, press, alt);

            var task = this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                tempValue.Text  = temp.ToString("F2") + "℃";
                humValue.Text   = humidity.ToString("F2") + "%";
                pressValue.Text = press.ToString("F2") + "hPa";
            });
        }