diff --git a/Script-Cookbook.md b/Script-Cookbook.md index ca5c402c..9349c44f 100644 --- a/Script-Cookbook.md +++ b/Script-Cookbook.md @@ -8,6 +8,7 @@ - [Multiple IR Receiver Synchronization](#Multiple-IR-Receiver-Synchronization) - [Fast Polling](#Fast-Polling) - [Switching and Dimming By Recognizing Mains Power Frequency](#Switching-and-Dimming-By-Recognizing-Mains-Power-Frequency) +- [WEB user io demo](#WEB-user-io-demo) [Back To Top](#top) @@ -1077,4 +1078,52 @@ dim="FF55"+hn(tmp*dimmlp)+"05DC0A" [Back To Top](#top) ------------------------------------------------------------------------------- \ No newline at end of file +------------------------------------------------------------------------------ + + +#### WEB user io demo +example to show how to implement WEB user io +used to control a light device via websend + +\>D +dimmer=0 +sw=0 +color="" +col1="" +red=0 +green=0 +blue=0 +ww=0 + +\>F +color=hn(red)+hn(green)+hn(blue)+hn(ww) +if color!=col1 +then +col1=color +=>websend [192.168.178.75] color %color% +endif + +if chg[dimmer]>0 +then +=>websend [192.168.178.75] dimmer %dimmer% +endif + +if chg[sw]>0 +then +=>websend [192.168.178.75] power1 %sw% +endif + +\>W +bu(sw "Light on" "Light off") +ck(sw "Light on/off   ") +sl(0 100 dimmer "0" "Dimmer" "100") +sl(0 255 red "0" "red" "255") +sl(0 255 green "0" "green" "255") +sl(0 255 blue "0" "blue" "255") +sl(0 255 ww "0" "warm white" "255") +tx(color "color:   ") + +[Back To Top](#top) + +------------------------------------------------------------------------------ +