// This method will be called by the application framework when the page is first loaded protected override async void OnNavigatedTo(NavigationEventArgs navArgs) { Debug.WriteLine("MainPage::OnNavigatedTo"); MakePinWebAPICall(); try { // Create a new object for our sensor class BME280 = new BME280Sensor(); //Initialize the sensor await BME280.Initialize(); //Create variables to store the sensor data: temperature, pressure, humidity and altitude. //Initialize them to 0. float temp = 0; float pressure = 0; float altitude = 0; float humidity = 0; //Create a constant for pressure at sea level. //This is based on your local sea level pressure (Unit: Hectopascal) const float seaLevelPressure = 1022.00f; //Read 10 samples of the data for (int i = 0; i < 10; i++) { temp = await BME280.ReadTemperature(); pressure = await BME280.ReadPreasure(); altitude = await BME280.ReadAltitude(seaLevelPressure); humidity = await BME280.ReadHumidity(); //Write the values to your debug console Debug.WriteLine("Temperature: " + temp.ToString() + " deg C"); Debug.WriteLine("Humidity: " + humidity.ToString() + " %"); Debug.WriteLine("Pressure: " + pressure.ToString() + " Pa"); Debug.WriteLine("Altitude: " + altitude.ToString() + " m"); Debug.WriteLine(""); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }