Running the selected channel of the LED RGBW module with the last value

Note: The tutorial presents a way to control a selected channel of the RGBW LED module - the control of the Dimmer module can be realized in an analogous way.


If you want to start e.g. the selected channel of the RGBW LED module on the last set value (greater than 0) you should:

* create a LED_R_last_value user feature:


Note: Enter 0 as the initial value. After a power failure or configuration upload, the LED_R_last_value feature will take the value 0.


* create a script, e.g. LED_R_last, that assigns the channel value to the user feature:

if(CLU->LED_strip->RedValue>0) then 
CLU->LED_R_last_value=CLU->LED_strip->RedValue
end



* assign the LED_R_last script to the OnValueChange event in the LED RGBW module:


* create a script, (LED_R_switch) that sets the appropriate values for the selected channel:

if(CLU->LED_R_last_value==0) then 
CLU->LED_strip->SetRedValue(255)
else
if(CLU->LED_R_last_value>0) then
if(CLU->LED_strip->RedValue==CLU->LED_R_last_value)
then CLU->LED_strip->SetRedValue(0)
else
CLU->LED_strip->SetRedValue(CLU->LED_R_last_value)
end
end
end



* assign a LED_R_switch script to OnClick event of the selected button:


Additionally, you can configure the brightening/dimming of the selected channel using the OnHold event and the HoldRedValue command. The configuration created in this way should be sent to the CLU.