// RCWL0516_nano_led_bare.ino #define sensorPin 15 // RCWL-0516 connected to this pin #define LRed 27 int sensorVal = 0; // initial RCWL-0516 output value as seen by ESP32 int led_fire_duration = 60000; void setup() { Serial.begin (9600); // initialize serial communication: Serial.println ("let’s start"); pinMode (sensorPin, INPUT); // RCWL-0516 output is input for esp32 pinMode(LRed, OUTPUT); digitalWrite (LRed, LOW); // LED off at start } void loop(){ sensorVal = digitalRead (sensorPin); // read sensor value if (sensorVal == LOW) { digitalWrite(LRed, LOW); Serial.println ("You are not moving"); } else { digitalWrite(LRed, HIGH); Serial.println ("You are moving"); delay (led_fire_duration); // during this period the led will be ON } }