Machsupport Forum
Third party software and hardware support forums. => PoKeys => Topic started by: TDAY on April 23, 2016, 12:05:55 PM
-
Hello,
Does anyone have an example of how to configure Mach4&Pokeys57E plugin for a External Push button or switch? Example: I have Pokeys pin 28 set as Digital Input, which is wired to my Cycle Start button. How do you configure plugin and Mach4 so Mach4 knows this input is Cycle Start?
Thanks,
Troy
-
Hi, Troy
Please follow the tutorial on our blog page: http://blog.poscope.com/mach4-tutorial-custom-signal-mapping/
Regards,
Matevž
-
Hello Matevz,
That looks great :) I will reply back here with results.
Thanks again,
Troy
-
Ok. Tutorial worked great, as Cycle Start button is now working. Thought i could use this tutorial for all my other inputs by copying the code for CycleStart and just change the ISIP input and the CycleStart() like below for CycleStop....
[mc.ISIG_INPUT27] = function (state)
if (state == 1) then
CycleStop()
end
but did not work.
I have more external buttons and switches to add like the CycleStart, is there a list or literature i should be referring to for the LUA script and Mach4 commands? Iam only somewhat familiar with Mach3 and the OEM codes in VisualBasic. Any help is much appreciated.
Thanks,
Troy
-
there is a Mach4 programming manual in the manual folder in the Mach4 folder on your C drive
you will have to make a table
-
I read the manual and found a short description of a Table, but not enough info for me on how to make one or where to place it and how to use it. Is there a example on how to make one for adding more inputs for physical external buttons and switches?
-
If you look at the code in the script, you will notice that you have somewhere in the beginning
---------------------------------------------------------------
-- Signal Library
---------------------------------------------------------------
SigLib = {
Then, one block as following for each signal
[mc.<signal name>] = function (state)
< code >
end
So, SigLib is a Table name, which contains handler functions for all signals in the list. The SigLib ends somewhere later on (around row 70) with a '}'
To add a new signal handler, make sure that you insert it in the Table and that you put a comma at the end of it.
---------------------------------------------------------------
-- Signal Library
---------------------------------------------------------------
SigLib = {
[mc.SIGNAL1] = function (state)
< code >
end,
[mc.SIGNAL2] = function (state)
< code >
end,
[mc.SIGNAL3] = function (state)
< code >
end,
...
[mc.SIGNALn] = function (state)
< code >
end
}
-
Here is what i tried to do for CycleStop....
-
But when i press the external cycle stop during a Gcode MDI run i get the following error.....
-
have it in it's own section the end end stops the table and state 1 on, state 0 off
-
I dont understand what you are saying...
-
how NeoTO says to have is how it is to be done not like what you have
-
TDAY, if you would like I can post how to do it... you should be able to modify the other output to make it work. You will find with this system you can do ANYTHING. But the cost is it is a bit more complex.
Looked again at your error and it is nothing to do with your signal script. You are calling set last error and not sending the Inst , String . Please look at your code in the CycleStop() function. If you post a screen shot we can have a look at it .