static void AirPressureV2CB(BrickletBarometerV2 sender, int airPressure)
    {
        if (brickletLCD != null)
        {
            string text = string.Format("Air Press {0,7:####.00} mb", airPressure / 1000.0);

            brickletLCD.WriteLine(2, 0, text);
            System.Console.WriteLine("Write to line 2: " + text);

            int temperature;

            try
            {
                temperature = sender.GetTemperature();
            }
            catch (TinkerforgeException e)
            {
                System.Console.WriteLine("Could not get temperature: " + e.Message);

                return;
            }

            // 0xDF == ° on LCD 20x4 charset.
            text = string.Format("Temperature {0,5:##.00} {1}C", temperature / 100.0, (char)0xDF);

            brickletLCD.WriteLine(3, 0, text);
            System.Console.WriteLine("Write to line 3: " + text.Replace((char)0xDF, '°'));
        }
    }
Exemplo n.º 2
0
    static void AirPressureV2CB(BrickletBarometerV2 sender, int airPressure)
    {
        latestAirPressure = airPressure / 1000.0;

        int temperature = sender.GetTemperature();

        latestTemperature = temperature / 100.0;
    }