I've just got this rule-set working to turn an individual LED on depending on the numerical value in an 'event' sent via MQTT (from Node-RED to a Wemos D1 Mini).
I'm surprised it works as I thought that ESP Easy didn't support nested IFs.
I'm running mega-20200222 on the Wemos.
Regards, David
Code: Select all
On ledcolour_code Do
TaskValueSet,1,1,%eventvalue% // Store %eventvalue% in dummy variable ledcolour#code
if [ledcolour#code]=0 // Clear all LEDs
gpio,15,0
gpio,13,0
gpio,12,0
else
if [ledcolour#code]=1 // Turn on RED LED
gpio,15,1
gpio,13,0
gpio,12,0
else
if [ledcolour#code]=2 // Turn on GREEN LED
gpio,15,0
gpio,13,1
gpio,12,0
else
if [ledcolour#code]=3 // Turn on BLUE LED
gpio,15,0
gpio,13,0
gpio,12,1
endif
endif
endif
endif
endon