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);
            }
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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);
            }
        }
Ejemplo 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);
        }
Ejemplo n.º 6
0
        protected async Task ReadTemp()
        {
            var conditions = await analogTemperature.Read();

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

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

            Console.WriteLine($"Temp: {conditions.Temperature}ºC, {conditions.Temperature.Value.CelciusToFahrenheit()}ºF.");
        }
Ejemplo 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);
        }
Ejemplo n.º 10
0
 public async Task <AtmosphericConditions> ReadTemperature()
 {
     return(await Temperature.Read());
 }