示例#1
0
 /// <summary>
 ///     Catch the PIR motion change interrupts and work out which interrupt should be raised.
 /// </summary>
 private void DigitalInputPortChanged(object sender, DigitalInputPortEventArgs e)
 {
     if (_digitalInputPort.State)
     {
         OnMotionStart?.Invoke(this);
     }
     else
     {
         OnMotionEnd?.Invoke(this);
     }
 }
示例#2
0
        /// <summary>
        ///     Catch the PIR motion change interrupts and work out which interrupt should be raised.
        /// </summary>
        //private void DigitalInputPortChanged(object sender, DigitalInputPortEventArgs e)
        //{

        //}
        private void _digitalInputPort_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
        {
            if (_digitalInputPort.Read() == GpioPinValue.High)
            {
                OnMotionStart?.Invoke(this);
            }
            else
            {
                OnMotionEnd?.Invoke(this);
            }
        }