private void LoggerTimer_Tick(object sender, object e) { if (pinValue == GpioPinValue.High) { pinValue = GpioPinValue.Low; pin.Write(pinValue); ReadWeatherData().ContinueWith((t) => { WeatherData wd = t.Result; AdafruitIO io = new AdafruitIO(); io.sendData(wd); Debug.WriteLine(wd.Created); //Write the values to your debug console Debug.WriteLine("Created: " + wd.Created + " ft"); txtTime.Text = "Created: " + wd.Created + " ft"; Debug.WriteLine("Temperature: " + wd.TemperatureinF + " deg F"); txtTemp.Text = "Temperature: " + wd.TemperatureinF + " deg F"; Debug.WriteLine("Pressure: " + wd.Pressureinmb + " mb"); txtPressure.Text = "Pressure: " + wd.Pressureinmb + " mb"; // string json = JsonConvert.SerializeObject(wd); lcd.gotoxy(0, 1); lcd.prints("Temperature:" + Math.Round(wd.TemperatureinF, 2)); lcd.gotoxy(0, 2); lcd.prints("Pressure: " + Math.Round(wd.Pressureinmb, 2)); Debug.WriteLine(""); }, TaskScheduler.FromCurrentSynchronizationContext()); ReadLightData().ContinueWith((t) => { LightData ld = t.Result; //AdafruitIO io = new AdafruitIO(); //io.sendData(ld); Debug.WriteLine("Lux: " + ld.Lux); Debug.WriteLine("Color Temp:" + ld.ColorTempinK + " K"); // string json = JsonConvert.SerializeObject(wd); lcd.gotoxy(0, 3); lcd.prints("Lux:" + Math.Round(ld.Lux, 2)); }, TaskScheduler.FromCurrentSynchronizationContext()); pinValue = GpioPinValue.High; pin.Write(pinValue); } else { pinValue = GpioPinValue.High; pin.Write(pinValue); } }
private void LoggerTimer_Tick(object sender, object e) { if (pinValue == GpioPinValue.High) { pinValue = GpioPinValue.Low; pin.Write(pinValue); ReadWeatherData().ContinueWith((t) => { WeatherData wd = t.Result; AdafruitIO io = new AdafruitIO(); io.sendData(wd); Debug.WriteLine(wd.Created); //Write the values to your debug console Debug.WriteLine("Created: " + wd.Created + " ft"); txtTime.Text = "Created: " + wd.Created + " ft"; Debug.WriteLine("Temperature: " + wd.TemperatureinF + " deg F"); txtTemp.Text = "Temperature: " + wd.TemperatureinF + " deg F"; Debug.WriteLine("Pressure: " + wd.Pressureinmb + " mb"); txtPressure.Text = "Pressure: " + wd.Pressureinmb + " mb"; // string json = JsonConvert.SerializeObject(wd); lcd.gotoxy(0, 1); lcd.prints("Temperature:" + Math.Round(wd.TemperatureinF,2)); lcd.gotoxy(0, 2); lcd.prints("Pressure: " + Math.Round(wd.Pressureinmb,2)); Debug.WriteLine(""); }, TaskScheduler.FromCurrentSynchronizationContext()); ReadLightData().ContinueWith((t) => { LightData ld = t.Result; //AdafruitIO io = new AdafruitIO(); //io.sendData(ld); Debug.WriteLine("Lux: " + ld.Lux); Debug.WriteLine("Color Temp:" + ld.ColorTempinK + " K"); // string json = JsonConvert.SerializeObject(wd); lcd.gotoxy(0, 3); lcd.prints("Lux:" + Math.Round(ld.Lux,2)); }, TaskScheduler.FromCurrentSynchronizationContext()); pinValue = GpioPinValue.High; pin.Write(pinValue); } else { pinValue = GpioPinValue.High; pin.Write(pinValue); } }