From 1752a64b634587be02b8ef4ea18bc58bdedce93a Mon Sep 17 00:00:00 2001 From: Alexandre B Date: Fri, 19 Jul 2024 18:53:52 -0400 Subject: [PATCH] . --- ESP32-C3-sm_I2C/src/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ESP32-C3-sm_I2C/src/main.cpp b/ESP32-C3-sm_I2C/src/main.cpp index 8c223862..d0644262 100644 --- a/ESP32-C3-sm_I2C/src/main.cpp +++ b/ESP32-C3-sm_I2C/src/main.cpp @@ -34,13 +34,14 @@ void TaskStatusLEDCode (void* parameters) { void TaskLightsAutoCode(void* parameters) { for (;;) { // If lighting is dark, then turn lights ON and increase delay interval + // Swap HIGH with LOW since we're using NPN transistor to control relay. if (light_sensor_reading > 1500) { - digitalWrite(LIGHTS_PIN, HIGH); + digitalWrite(LIGHTS_PIN, LOW); vTaskDelay(pdMS_TO_TICKS(10000)); } // If lighting is bright, then turn lights OFF and decrease delay interval else { - digitalWrite(LIGHTS_PIN, LOW); + digitalWrite(LIGHTS_PIN, HIGH); vTaskDelay(pdMS_TO_TICKS(1000)); } }