To detect the motion of an object, an important sensor is PIR. For that, first you need to define a variable for the PIR sensor by setting the respective pin number into it. You need to define a variable for the LED sensor and set it to its respective Pi number, as explained in the step 1 in the following list. By using these pin numbers, we will identify whether the PIR sensor detected an object or not; based on the PIR sensor value, you will turn the LED light on/off.
- Open the MainPage.xaml.cs file and declare the following properties at the top of the class, as follows:
//Status LED variables private const int LED_PIN = 5; private GpioPin PinLED; ...