mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-08 05:27:09 +00:00
Update main.cpp
This commit is contained in:
@@ -32,12 +32,18 @@ void TaskStatusLEDCode (void* parameters) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TaskLightsAutoCode(void* parameters) {
|
void TaskLightsAutoCode(void* parameters) {
|
||||||
|
TickType_t delay = pdMS_TO_TICKS(1000); // Variable for storing delay interval.
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (light_sensor_reading > 1000)
|
// If lights are dark, then turn lights ON and increase delay interval
|
||||||
|
if (light_sensor_reading > 1000) {
|
||||||
digitalWrite(LIGHTS_PIN, HIGH);
|
digitalWrite(LIGHTS_PIN, HIGH);
|
||||||
else
|
delay = pdMS_TO_TICKS(10000);
|
||||||
|
}
|
||||||
|
// If lights are bright, then turn lights OFF and decrease delay interval
|
||||||
|
else {
|
||||||
digitalWrite(LIGHTS_PIN, LOW);
|
digitalWrite(LIGHTS_PIN, LOW);
|
||||||
vTaskDelay(pdMS_TO_TICKS(5000));
|
vTaskDelay(pdMS_TO_TICKS(5000));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user