//private static string iotHubUri = "IoTHubMember.azure-devices.net"; //private static string deviceId = "MyRpi"; //private static string deviceKey = "F4CptKs4Pn9bc1oi43GXsqFtgsKAFnEd2q5XA53rKRk="; public MainPage() { this.InitializeComponent(); DeviceClient = DeviceClient.CreateFromConnectionString(connectionStringStandart, TransportType.Amqp); bME280 = new BuildAzure.IoT.Adafruit.BME280.BME280Sensor(); DeviceToCloudMessage(); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); _bme280 = new BuildAzure.IoT.Adafruit.BME280.BME280Sensor(); await _bme280.Initialize(); _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromSeconds(30); _timer.Tick += _timer_Tick; _timer.Start(); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var dis = await DeviceInformation.FindAllAsync(I2cDevice.GetDeviceSelector()); var i2cDevice = await I2cDevice.FromIdAsync(dis[0].Id, new I2cConnectionSettings(0x55)); // exception thro _bme280 = new BuildAzure.IoT.Adafruit.BME280.BME280Sensor(); await _bme280.Initialize(); _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromSeconds(5); _timer.Tick += _timer_Tick; _timer.Start(); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { Debug.WriteLine("OnNavigatedTo"); base.OnNavigatedTo(e); _bme280 = new BuildAzure.IoT.Adafruit.BME280.BME280Sensor(); await _bme280.Initialize(); Debug.WriteLine("BME280Sensor is initialized"); _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMinutes(30); _timer.Tick += CheckWeather; _timer.Start(); CheckWeather(this, null); }