I use a PIR Sensor & NodeMCU ESP8266 Amica. I program NodeMCU on the Arduino IDE. I connected the sensor's output to the RST pin on my NodeMCU. So, when the PIR detect a movement, the output will be HIGH and so the NodeMCU will reboot. I tested my code by uploading the arduino's sketch to the NodeMCU, everything is fine. But, if I disconnect and reconnect the NodeMCU to my computer, the sensor doesn't seem working... The setup is executed but when I create movements in front of the PIR sensor, nothing is happening...
The question is, why ? When I upload the sketch to the NodeMCU, everything work, but when I disconnect and reconnect (or when I plug the NodeMCU on an alimentation), nothing work... Thank's for reeding me, I hope you'll found an answer ;)
Code (post request to a php script on setup), there is just the setup function, the loop function is empty :
WiFi.begin(ssid, password);
Serial.println(ESP.getResetReason());
HTTPClient http;
http.begin("PHP_SCRIPT");
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
http.POST("message=Hello, from ESP8266");
http.writeToStream(&Serial);
http.end();
PIR Sensor = http://4tronix.co.uk/store/index.php?rt=product/product&keyword=pir&category_id=0&product_id=135