Пример #1
0
        public static void Main()
        {
            _deviceOk = false;
            while (!_deviceOk)
            {
                try
                {
// ReSharper disable RedundantArgumentDefaultValue
                    _pres = new PressureClick(Hardware.SocketOne, 0xBA >> 1, MBN.Enums.ClockRatesI2C.Clock100KHz);
// ReSharper restore RedundantArgumentDefaultValue
                    _deviceOk = true;
                }
                catch (DeviceInitialisationException)
                {
                    Debug.Print("Init failed, retrying...");
                }
            }

            while (true)
            {
                Debug.Print("Pression = " + _pres.ReadPressure() + " hPa");
                Debug.Print("Temperature = " + _pres.ReadTemperature().ToString("F2") + "°");
                Thread.Sleep(1000);
            }
        }
Пример #2
0
        public static void Main()
        {
            _deviceOk = false;
            while (!_deviceOk)
            {
                try
                {
                    _pres     = new PressureClick(Hardware.SocketOne, 0xBA >> 1);
                    _deviceOk = true;
                }
                catch (DeviceInitialisationException)
                {
                    Debug.WriteLine("Init failed, retrying...");
                }
            }

            while (true)
            {
                Debug.WriteLine("Pression = " + _pres.ReadPressure() + " hPa");
                Debug.WriteLine("Temperature = " + _pres.ReadTemperature().ToString("F2") + "°");
                Thread.Sleep(1000);
            }
        }