Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: jbraddock on July 01, 2018, 04:09:04 PM
-
I HAVE TRIED to activate cycle start with a script i got from joe average but we just cant get it to work, i know my input is working we have it activating the diagnostic led but cant seem to get it to activate Cycle Start when you trigger that input #1
Cycle Start()
[mc.ISIG_INPUT10]=function(state)
if state==1 then
CycleStart()
end
end
i have put it in the left down script, the left up script i have put the left up an left down actions to cycle start with an without the code installed in the clicked boxs, not sure what the exact scenario is that i need to have them installed an what order needs to be on an off with the left dwn/up clicked act/srpt/ boxs,...
im trying to get all my main screen buttons onto external buttons or either have them where they can be triggered by key strokes an use a macro keyboard to activate them, i dont care which way but this was suppose to be the easiest way to do it an its not been easy to figure out,... i have tried some of the scripts in another post similar to what im trying but those didn't work either,...so im tryn to determining if its in my inputs or in the scripts,...
-
Hi,
i have put it in the left down script, the left up script i have put the left up an left down actions
Wrong, that code needs to go in the SigLib table at the top of the screen load script.
Craig
-
jbraddock
Notice that individual table entries are separated by a comma , so be sure to include one after your code unless it is the final entry in SigLib{}.
Allan
-
Hi,
i have put it in the left down script, the left up script i have put the left up an left down actions
Wrong, that code needs to go in the SigLib table at the top of the screen load script.
Craig you posted screen shots with them circled to where they go..? or atleast thats what i understanded you were saying to put them, now your saying they dont go inside the script boxs?
if so im confused as to where this sig lib is?
-
Hi,
I am at work and so can't show you at the moment.
Open the screenload script and near the very top you'll see:
SigLib{
which is the start of the signal library table. You just need to put another entry in it.
It tell Mach 'this is the signal I'm interested in....and this is what I want you to do...'
Craig
-
Open the Screen Load script in the screen editor and find the line:
SigLib = {
This is the beginning of the signal table. Now try inserting the following between 2 existing entries:
--AW: Set cycle start if user presses key assigned to Input0
[mc.ISIG_INPUT0] = function (state)
if (state == 1) then
CycleStart()
end
end,
--AW: Set feed hold or stop if user presses key assigned to Input1
[mc.ISIG_INPUT1] = function (state)
if (state == 1) then
local hSig = mc.mcSignalGetHandle(inst, mc.OSIG_RUNNING_GCODE)
local codeRunning = mc.mcSignalGetState(hSig)
if (codeRunning == 1) then
mc.mcCntlFeedHold(inst)
--CycleStop()
end
end
end,
Use your own inputs instead of inputs 0 and 1. That's all there is to it.
Allan
-
Open the Screen Load script in the screen editor and find the line:
SigLib = {
This is the beginning of the signal table. Now try inserting the following between 2 existing entries:
--AW: Set cycle start if user presses key assigned to Input0
[mc.ISIG_INPUT0] = function (state)
if (state == 1) then
CycleStart()
end
end,
--AW: Set feed hold or stop if user presses key assigned to Input1
[mc.ISIG_INPUT1] = function (state)
if (state == 1) then
local hSig = mc.mcSignalGetHandle(inst, mc.OSIG_RUNNING_GCODE)
local codeRunning = mc.mcSignalGetState(hSig)
if (codeRunning == 1) then
mc.mcCntlFeedHold(inst)
--CycleStop()
end
end
end,
Use your own inputs instead of inputs 0 and 1. That's all there is to it.
Allan
thank you,..ive been in the wrong place all day,
-
Hi,
I am at work and so can't show you at the moment.
Open the screenload script and near the very top you'll see:
SigLib{
which is the start of the signal library table. You just need to put another entry in it.
It tell Mach 'this is the signal I'm interested in....and this is what I want you to do...'
Craig
ok
-
Hi,
the signal library takes a little bit of 'getting your head around' however when you do
you'll soon realize that this method is light years ahead of Mach3 which polls its inputs.
Further now that you have that one example under your belt you'll be able to repeat it with
all manner of variations...and so simple!
Craig
-
its not easy for me apparently,.... ive tried numerous ways an it keeps
Saying...
LUA SYNTAX ERROR DURING PRE COMPILATION UNEXPECTED SYMBOL NEAR =
-
Hi,
please post the code, cut and paste so that it is exact.
Craig
-
Hi,
just noticed that other examples:
if (state==1) then
ie it might be necessary to put the parenthesies around the conditional. As someone pointed out that
Lua has syntax 'that only a mother could love'.
Craig
-
Hi,
just noticed that other examples:
if (state==1) then
ie it might be necessary to put the parenthesies around the conditional. As someone pointed out that
Lua has syntax 'that only a mother could love'.
Craig
finally got it it was that code you gave me was wrong, i got one off another post an its working FINALLY!!!! THANK GOD!!!
NOW TO DO ENABLE can i do it the same way?
-
Hi,
have a look at the <Enable> button event properties in screen edit mode. If it has
a script or a function as an event, but NOT an action, then yes you can do exactly the
same thing.
Craig
-
i tried just changing CyleStart to MachEnable an no go
-
Hi,
did you check that <Enable> is a function? If it is, have you called the function using the correct
syntax:
MachEnable().......note Lua is case sensitive and the parenthesies indicate to Lua that its a function
thus
MachEnable
machenable()
and
MachEnable() are all different.
Craig
-
Hi,
did you check that <Enable> is a function? If it is, have you called the function using the correct
syntax:
MachEnable().......note Lua is case sensitive and the parenthesies indicate to Lua that its a function
thus
MachEnable
machenable()
and
MachEnable() are all different.
Craig
yeah i found some scripts an got it working THANKS!, problem now is im outa inputs an bob im using is full of outputs an not inputs,...so idk,...im looking into the Pokeys 57cnc with membrane buttons,... may go that route,... so hopefully all the scripts will work the same for that card
-
Hi,
or buy another BoB, or even two, for $23.00 each and have as many inputs as you could shake a stick at!
Craig
-
you can use your keyboard num pad, I tried it a few years ago and it worked
-
What do you mean? Im still tryn to figure out how to set button functions to keyboard keys
-
Hi,
or buy another BoB, or even two, for $23.00 each and have as many inputs as you could shake a stick at!
Craig
Which bob is $23.00 that your talking abought
-
https://www.automationtechnologiesinc.com/products-page/motion-controllers/c10-bidirectional-breakout/
-
https://www.automationtechnologiesinc.com/products-page/motion-controllers/kl-db25-breakout-board/
-
Hi,
I meant the C10 BoB, it has a bi-directional buffer which allows pins 2-9 to be used as inputs
whereas the kl-bd25 pins 2-9 can ONLY be used as outputs.
You need more inputs and so a BoB which has bi-directional pins 2-9 is what you need.
Craig
-
Hi,
you could use the C13 at only $9.00 but it has no buffer ICs, if you have a cock-up with the wiring
you could blow the ESS. I prefer BoBs with a buffer, blowing a cheap BoB I'd live with but I'd be
p.....sed off if I blew my ESS!
Craig
-
you can use your keyboard num pad, I tried it a few years ago and it worked
What do you mean, im tryn to figure out how to activate by keyboard instead of by input button,... in other words how do i make say enable work when i hit a keyboard input like spacebar or another keystroke