Rule Examples/en: различия между версиями

(Новая страница: «=== Examples === {{YouTube |link=https://youtu.be/C60KB7TCeKg |text= Rule example }} In the example, we are using the WB-MCM8 to control the first dimmer channel WB-MDM3: # Short press turns on the channel. # Double - turns off the channel. # Long - increases brightness. # Short, then long - reduces brightness.»)
(Новая страница: «Since changing the brightness requires a time-consuming action, we use a timer. We also control the state of the input with the button and stop the action when the button is released.»)
Строка 322: Строка 322:
# Short, then long - reduces brightness.
# Short, then long - reduces brightness.


<div lang="ru" dir="ltr" class="mw-content-ltr">
Since changing the brightness requires a time-consuming action, we use a timer. We also control the state of the input with the button and stop the action when the button is released.
Так как изменение яркости требует растянутое во времени действие, то мы используем таймер. Также мы контролируем состояние входа с кнопкой и прекращаем действие при отпускании кнопки.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
/* ---------------------------- */
/* ---------------------------- */
/* 1. Single Press Counter: On action*/
/* 1. Single Press Counter: On action*/
/* ---------------------------- */
/* ---------------------------- */
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
defineRule({
defineRule({
   whenChanged: "wb-mcm8_20/Input 1 Single Press Counter",
   whenChanged: "wb-mcm8_20/Input 1 Single Press Counter",
Строка 340: Строка 335:
   }
   }
});
});
</div>




<div lang="ru" dir="ltr" class="mw-content-ltr">
/* ---------------------------- */
/* ---------------------------- */
/* 2. Double Press Counter: Off action*/
/* 2. Double Press Counter: Off action*/
/* ---------------------------- */
/* ---------------------------- */
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
defineRule({
defineRule({
   whenChanged: "wb-mcm8_20/Input 1 Double Press Counter",
   whenChanged: "wb-mcm8_20/Input 1 Double Press Counter",
Строка 356: Строка 347:
   }
   }
});
});
</div>