- Notifications
You must be signed in to change notification settings - Fork13.3k
Closed
Labels
Description
Platform
- Hardware:[ESP-12]
- Core Version:[2.7.4] & [3.0.0]
- Development Env:[Arduino IDE]
- Operating System:[Windows]
Settings in IDE
- Module: [Generic ESP8266]
- Flash Mode:[qio]
- Flash Size: [4MB]
- lwip Variant: [v2 Higher Bandwidth]
- Reset Method:[nodemcu]
- Flash Frequency:[80Mhz]
- CPU Frequency:[80Mhz]
- Upload Using:[OTA|SERIAL]
- Upload Speed: [115200]
Problem Description
Any Ticker tasks fire OK if time is short (tested up to 60 seconds (60 000ms)). However, when I try to control the brightness after sunset, the time gets big (for example 44944 sec (44 944 000ms)) & the same task no longer start. The code below is not exactly what I have in my project, but close.
MCVE Sketch
#include<Arduino.h>#include<Ticker.h>Ticker ticker_autoBrightness;uint32_t timeSec =44079;//12h:14m:39svoidsetup() {pinMode(2, OUTPUT);task_clockDayBrightness();}voidloop() {//empty}voidtask_clockDayBrightness(){digitalWrite(2, LOW);//turn LED on ticker_autoBrightness.once_scheduled(timeSec, task_clockNightBrightness);}voidtask_clockNightBrightness(){digitalWrite(2, HIGH);//turn LED off ticker_autoBrightness.once_scheduled(timeSec, task_clockDayBrightness);}