Example #1
0
        private void InitDHT22()
        {
            GpioController gpc      = GpioController.GetDefault();
            GpioPin        dht22Pin = null;

            if (gpc == null)
            {
                App.log.LogEvent("Contrôleur GPIO absent !", null, LoggingLevel.Warning);
            }
            else
            {
                GpioOpenStatus status;
                if (!gpc.TryOpenPin(17, GpioSharingMode.Exclusive, out dht22Pin, out status))
                {
                    App.log.LogEvent("L'accès à la broche GPIO 17 est impossible : " + status.ToString(), null, LoggingLevel.Warning);
                }
            }
            _dht22 = new DHT22(dht22Pin);
            DHT22SPL.DataContext = new DHT22VM(_dht22);
        }
 public void Save(DHT22 model)
 {
     this.models.InsertOne(model);
 }