Exemplo n.º 1
0
        public DHT(IGpioPin datatPin, DHTSensorTypes sensor)
        {
            _logger.Information("Sensor setup...");

            if (datatPin != null)
            {
                try
                {
                    _dataPin      = datatPin;
                    _firstReading = true;
                    _prevReading  = DateTime.MinValue;
                    _data         = new UInt32[6];
                    _sensorType   = sensor;
                    //Init the data pin
                    _dataPin.PinMode = GpioPinDriveMode.Output;
                    _dataPin.Write(GpioPinValue.High);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex, "Error in DHT setup");
                }
            }
            else
            {
                throw new ArgumentException("Parameter cannot be null.", "dataPin");
            }
        }
Exemplo n.º 2
0
 public DHT(GpioPin datatPin, DHTSensorTypes sensor)
 {
     if (datatPin != null)
     {
         _dataPin      = datatPin;
         _firstReading = true;
         _prevReading  = DateTime.MinValue;
         _data         = new UInt32[6];
         _sensorType   = sensor;
         //Init the data pin
         _dataPin.PinMode = GpioPinDriveMode.Output;
         _dataPin.Write(GpioPinValue.High);
     }
     else
     {
         throw new ArgumentException("Parameter cannot be null.", "dataPin");
     }
 }