Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: daniba73 on November 07, 2018, 01:57:22 AM

Title: Assign input to the controller, CICLE START button
Post by: daniba73 on November 07, 2018, 01:57:22 AM
Hello to the whole forum.
I'm italian, I use google translate.
I would like to assign an external key to the SINGLE BLOCK function, then an Input for the controller.
how can I do?
I own CSMIO-IP / S
thank you.
Title: Re: Assign input to the controller, CICLE START button
Post by: Cbyrdtopper on November 07, 2018, 08:41:12 AM
daniba73,
Once you map a button to an input in Mach4 then you  can put this script into the signal library in the screen load script. 
I have this example mapped to input 5

 
[mc.ISIG_INPUT1] = function (state)
     if (state == 1) then --
   --Single Block Toggle Test
   local inst = mc.mcGetInstance()

   local SBMode = mc.mcCntlGetSingleBlock(inst)
   if SBMode == 1 then
      mc.mcCntlSetSingleBlock(inst, 0)
    else
      mc.mcCntlSetSingleBlock(inst, 1)
    end
    end
end,
Title: Re: Assign input to the controller, CICLE START button
Post by: daniba73 on November 07, 2018, 05:09:56 PM
Hi,
Yes, it works
part immediately active.
can you do it reverse?
Title: Re: Assign input to the controller, CICLE START button
Post by: Cbyrdtopper on November 07, 2018, 07:33:32 PM
Daniba73,
It toggles correctly? 
You can reverse the logic, yes.

[mc.ISIG_INPUT1] = function (state)
     if (state == 1) then --
   --Single Block Toggle Test
   local inst = mc.mcGetInstance()

   local SBMode = mc.mcCntlGetSingleBlock(inst)
   if SBMode == 0 then
      mc.mcCntlSetSingleBlock(inst, 1)
    else
      mc.mcCntlSetSingleBlock(inst, 0)
    end
    end
end,
Title: Re: Assign input to the controller, CICLE START button
Post by: daniba73 on November 08, 2018, 05:54:56 AM
Hi,
toggles correctly.
thanks you have been very kind!!
Title: Re: Assign input to the controller, CICLE START button
Post by: Cbyrdtopper on November 08, 2018, 04:00:21 PM
So it works like you want now?
Title: Re: Assign input to the controller, CICLE START button
Post by: daniba73 on November 09, 2018, 01:35:15 AM
Yes,Yes!
Very good!
thank you again!

P.S. I would like to add some sounds to Mach4, but I open a dedicated topic.
Title: Re: Assign input to the controller, CICLE START button
Post by: daniba73 on November 09, 2018, 04:07:49 AM
Note:
with the second code, it did not work for me.
I'm using the first one.
Mach4 boot active part, but it is not a problem.