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.
Still based on my project on home automation system that controls water pumps and taps based on motion detection using the Zephyr RTOS on an ESP32. I added more relay modules for each tap so i can control multiple taps based on the same motion detection But the `Multiple relays not activating simultaneously` how can i resolve this.
define TAP1_PIN 25
define TAP2_PIN 26
void main(void) {
gpio_pin_configure(relay_device, TAP1_PIN, GPIO_OUTPUT);
gpio_pin_configure(relay_device, TAP2_PIN, GPIO_OUTPUT);
while (1) {
if (gpio_pin_get(pir_device, PIR_SENSOR_PIN)) {
gpio_pin_set(relay_device, TAP1_PIN, 1);
gpio_pin_set(relay_device, TAP2_PIN, 1);
k_sleep(K_SECONDS(5)); // Taps run for 5 seconds
gpio_pin_set(relay_device, TAP1_PIN, 0);
gpio_pin_set(relay_device, TAP2_PIN, 0);
}
k_sleep(K_MSEC(500));
}
}
CONTRIBUTE TO THIS THREAD