mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-08 10:30:54 +00:00
Update main.cpp
This commit is contained in:
@@ -32,13 +32,19 @@ 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));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskSensorValuesCode (void* parameters) {
|
void TaskSensorValuesCode (void* parameters) {
|
||||||
|
Reference in New Issue
Block a user