Become a leader in the IoT community!
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Am working on a a home automation system that controls water pumps and taps based on motion detection using the Zephyr RTOS on an ESP32 microcontroller, how can i properly detect motion using a PIR (Passive Infrared) sensor with the ESP32?
this is what i have tried
include <zephyr.h>
include <device.h>
include <drivers/gpio.h>
define PIR_SENSOR_PIN 23
void main(void) {
const struct device pir_device = device_get_binding(DT_LABEL(DT_NODELABEL(gpio)));
gpio_pin_configure(pir_device, PIR_SENSOR_PIN, GPIO_INPUT);
while (1) {
if (gpio_pin_get(pir_device, PIR_SENSOR_PIN)) {
// Motion detected
printk("Motion Detected!n");
}
k_sleep(K_MSEC(500));
}
}
But am getting the error `Device not found`, how can i properly resolve this
CONTRIBUTE TO THIS THREAD