I've a problem with a timer not working. I think the code is ok, but maybe I've looked at it for too long now and I'm missing something really silly! I've simplified it down to a very minimal piece of code, which still doesn't work, and I've tried it on two different ESP boards.
I can't work out what's wrong here... can anyone help?
Code: Select all
On timerstart do
timerSet,1,2
TaskValueSet,12,1,0
endon
On timerstop do
timerSet,1,0
endon
On Rules#Timer = 1 do
if [MyVars#ctr] = 0
gpio,4,1
TaskValueSet,12,1,1
else
gpio,4,0
TaskValueSet,12,1,0
endif
timerSet,1,2
endon
Type: Generic - dummy device
Name: MyVars
Enabled: [tick]
Interval: 60
Simulate: SENSOR_TYPE_SINGLE
Values:
#1 ctr 0 decimals
#2-#4 names empty, 2 decimals
I expect that code to turn the LED alternately on and off every 2 seconds. But the LED remains stubbornly off! A quick "gpio,4,1" turns it on just fine.
I've tried changing the GPIO: GPIO2 (D4), GPIO14 (D5) and GPIO4 (D2), none works.
ESP image is ESP_Easy_mega-20180519_test_ESP8266_4096.
Also - is there a smart way to set a GPIO-connected LED to flash at a given frequency, rather than using timers? I was hoping that the PWM commands might provide something, but they seem only intended to control brightness.
Thanks!
Jeff