Example #1
0
        protected virtual void OnPIRMotionStateChange(PIRMotionDetectEventArgs e)
        {
            PIRMotionDetectEventHandler handler = PIRMotionDetectStateChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Example #2
0
 /// <summary>
 /// Will be fired when motion detection state is changed.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void PIRInt_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
 {
     if (args.Edge == GpioPinEdge.RisingEdge)
     {
         PIRMotionDetectEventArgs ea = new PIRMotionDetectEventArgs(true);
         OnPIRMotionStateChange(ea);
     }
     else if (args.Edge == GpioPinEdge.FallingEdge)
     {
         PIRMotionDetectEventArgs ea = new PIRMotionDetectEventArgs(false);
         OnPIRMotionStateChange(ea);
     }
 }