For now, let's test the PIR module to check that it is working. In order to achieve this you will need:
- An ESP8266 module (NodeMCU, WeMos, or an other board)
- A PIR module
- A Breadboard
- Wires
For the software part use the following sketch:
- Define the PIR as it will be connected to the D7 pin, set the pirState to LOW assuming that the PIR is OFF, and set the current state to 0:
#define PIN_PIR D7 int pirState = LOW; int current_value = 0;
- During setup we will declare the D7 pin where the PIR is connected to an input pin:
void setup() { pinMode(PIN_PIR, INPUT); Serial.begin(115200); }
Now continually monitor the ...