0
Answered

One button,multiple lights

Vulcan 2 years ago in Applications / i3 Pro updated by Aleksandr Romanov (CTO) 2 years ago 3

Hello there!

What kind of button I have to build,to turn on multiple channels on the same button.first press turn on first light,second press turns second light and so on.

Waiting for user's reply

Hello.
You can use the usual button, but you will have to register the commands in the script. For example, this:

var flag = 0;
IR.AddListener(IR.EVENT_ITEM_PRESS,IR.GetPage("Page 1").GetItem("Item 1"),function()
{
   flag++;
    switch (flag){
      case 1:
         IR.GetPage("Page 1").GetItem("Item 2").Value = 1;
         break;
      case 2:
         IR.GetPage("Page 1").GetItem("Item 3").Value = 1;
         break;
      case 3:
         IR.GetPage("Page 1").GetItem("Item 4").Value = 1;
         break;
      case 4:
         IR.GetPage("Page 1").GetItem("Item 5").Value = 1;
         break;
      default:
         IR.GetPage("Page 1").GetItem("Item 2").Value = 0;
         IR.GetPage("Page 1").GetItem("Item 3").Value = 0;
         IR.GetPage("Page 1").GetItem("Item 4").Value = 0;
         IR.GetPage("Page 1").GetItem("Item 5").Value = 0;
         flag = 0;
      }
          
})
Item 1 is a usual button, items 2-5 are trigger buttons, they will change their state when you click on item 1.

Thank you very much,but I don't know the js so good.