#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#define GPIO_NUM_4
void app_main() {
printf("Motion sensor program started!\n");
while (1) {
// Read the state of the motion sensor
int motion_detected = GPIO_NUM_4(MOTION_SENSOR_PIN);
if (motion_detected) {
printf("MOTION DETECTED\n");
vTaskDelay(1000 / portTICK_PERIOD_MS); // Delay to prevent spamming the output
}
vTaskDelay(100 / portTICK_PERIOD_MS); // Polling delay
}
}