async Task Start()
        {
            while (true)
            {
                DateTime clock = DateTime.Now.AddHours(-8);

                graphics.Clear();

                graphics.DrawText(0, 1, $"{clock:hh}");
                graphics.DrawText(0, 9, $"{clock:mm}");
                graphics.DrawText(0, 17, $"{clock:ss}");
                graphics.DrawText(0, 25, $"{clock:tt}");

                if (showDate)
                {
                    graphics.Clear();

                    graphics.DrawText(0, 1, $"{clock:dd}");
                    graphics.DrawText(0, 9, $"{clock:MM}");
                    graphics.DrawText(0, 17, $"{clock:yy}");

                    graphics.DrawHorizontalLine(0, 24, 7, true);

                    var temperature = await analogTemperature.Read();

                    graphics.DrawText(0, 26, $"{(int) temperature.Celsius}");
                }

                graphics.Show();
                Thread.Sleep(1000);
            }
        }
Esempio n. 2
0
        async void ButtonClicked(object sender, EventArgs e)
        {
            onboardLed.SetColor(Color.Orange);

            var newMoisture = await capacitive.Read();

            var newTemperature = await analogTemperature.Read();

            displayController.UpdateMoisturePercentage(newMoisture.New, moisture.New);
            moisture = newMoisture;

            displayController.UpdateTemperatureValue(newTemperature.Temperature.Value, temperature.Temperature.Value);
            temperature = newTemperature;

            onboardLed.SetColor(Color.Green);
        }
Esempio n. 3
0
        async Task GetTemperature()
        {
            onboardLed.StartPulse(Color.Orange);

            // Get indoor conditions
            var roomTemperature = await analogTemperature.Read();

            // Get outdoor conditions
            var outdoorConditions = await WeatherService.GetWeatherForecast();

            // Format indoor/outdoor conditions data
            var model = new WeatherViewModel(outdoorConditions, roomTemperature);

            // Update Temperature values and weather description
            displayView.WriteLine($"In: {model.IndoorTemperature.ToString("00")}C | Out: {model.OutdoorTemperature.ToString("00")}C", 2);
            displayView.WriteLine($"{model.Weather}", 3);

            onboardLed.StartPulse(Color.Green);
        }
Esempio n. 4
0
        async Task Start()
        {
            var dateTime = await WeatherService.GetTimeAsync();

            Device.SetClock(new DateTime(
                                year: dateTime.Year,
                                month: dateTime.Month,
                                day: dateTime.Day,
                                hour: dateTime.Hour,
                                minute: dateTime.Minute,
                                second: dateTime.Second));

            while (true)
            {
                DateTime clock = DateTime.Now;

                graphics.Clear();

                graphics.DrawText(0, 1, $"{clock:hh}");
                graphics.DrawText(0, 9, $"{clock:mm}");
                graphics.DrawText(0, 17, $"{clock:ss}");
                graphics.DrawText(0, 25, $"{clock:tt}");

                if (showDate)
                {
                    graphics.Clear();

                    graphics.DrawText(0, 1, $"{clock:dd}");
                    graphics.DrawText(0, 9, $"{clock:MM}");
                    graphics.DrawText(0, 17, $"{clock:yy}");

                    graphics.DrawHorizontalLine(0, 24, 7, true);

                    float temperature = analogTemperature.Read().Result.Temperature.Value;

                    graphics.DrawText(0, 26, $"{(int) temperature}");
                }

                graphics.Show();
                Thread.Sleep(1000);
            }
        }
Esempio n. 5
0
        async Task Start()
        {
            onboardLed.StartPulse(Color.Magenta);

            // Get indoor conditions
            var indoorConditions = await analogTemperature.Read();

            // Get outdoor conditions
            var outdoorConditions = await WeatherService.GetWeatherForecast();

            onboardLed.StartPulse(Color.Orange);

            // Format indoor/outdoor conditions data
            var model = new WeatherViewModel(outdoorConditions, indoorConditions);

            // Send formatted data to display to render
            displayController.UpdateDisplay(model);

            onboardLed.StartPulse(Color.Green);
        }
Esempio n. 6
0
        protected async Task ReadTemp()
        {
            var conditions = await analogTemperature.Read();

            Console.WriteLine($"Initial temp: { conditions.Temperature }");
        }
Esempio n. 7
0
        public async void Dispatch(DeviceLookup lookup = null)
        {
            AtmosphericConditions temp = await _temperature.Read();

            Temperature = temp.Temperature.HasValue ? temp.Temperature.Value : 0;
        }
Esempio n. 8
0
        protected async Task ReadInitialTemperature()
        {
            var conditions = await temperatureSensor.Read();

            Console.WriteLine($"Temp: {conditions.Temperature}ºC, {conditions.Temperature.Value.CelciusToFahrenheit()}ºF.");
        }
Esempio n. 9
0
        /// <summary>
        /// Performs a one-off reading of the temp sensor.
        /// </summary>
        /// <returns></returns>
        protected async Task <AtmosphericConditions> ReadTemp()
        {
            var conditions = await analogTemperature.Read();

            return(conditions);
        }
Esempio n. 10
0
 public async Task <AtmosphericConditions> ReadTemperature()
 {
     return(await Temperature.Read());
 }