Пример #1
0
        public async Task <double> GetPressure()
        {
            using (var sensor = new Bme280(_bmp280))
            {
                sensor.SetPowerMode(PowerMode.Forced);
                double pressure = await sensor.ReadPressureAsync();

                var temp = await sensor.ReadTemperatureAsync();

                var alt = await sensor.ReadAltitudeAsync(pressure);

                double humid = await sensor.ReadHumidityAsync();

                _logger.LogDebug(
                    $"Pressure value: {pressure}; PowerMode: {sensor.ReadPowerMode()}; Temperature: {temp.Celsius}; Altitude: {alt}; Humidity: {humid}");

                return(pressure);
            }
        }