Hello Guest it is April 28, 2024, 04:11:12 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jbraddock

Pages: « 1 2 3 4 5 6 7 8 9 »
21
Hi,

Quote
And THAT'S IT!  If you put that little piece of code into the SigLib table which is at the top of the screenload script

The code goes into the signal library table (SigLib{}).

Craig

22
Hi,
Quote
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?

23
Hi,
oops, sorry forgot to attach the screen shots....

Craig


this is what i went off of this is where i put code i treid left dwn an up script,...thats not right, thought thats where you said an circled it to show where it gos?

its nort showing screen shots for some reason ive tried to post them but they artent posting

24
i went of this this isnt right? i put code inside the left up

25
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,...

26
i dont change this at all right?


Hi.
can't help with all of those questions but I can show you how to do a few of them.

Have you watched the 'Edit Screen' video....you need to watch it.

In edit screen mode have a look at the <Cycle Start> button events. I have posted a screen shot of it. Note that the event has a 'left up script' That means when the screen button
is released the nominated script executes. In this case its not a script per se but rather a Lua function CycleStart().

Just as a matter of interest this is the source code of the function.....its in the screen load script:
Code: [Select]
---------------------------------------------------------------
-- Cycle Start() function.
---------------------------------------------------------------
function CycleStart()
    local rc;
    local tab, rc = scr.GetProperty("MainTabs", "Current Tab")
    local tabG_Mdione, rc = scr.GetProperty("nbGCodeMDI1", "Current Tab")
    local tabG_Mditwo, rc = scr.GetProperty("nbGCodeMDI2", "Current Tab")
   
    --See if we have to do an MDI command and if so, which one
    if ((tonumber(tab) == 0 and tonumber(tabG_Mdione) == 1) or (tonumber(tab) == 2 and tonumber(tabG_Mditwo) == 1 )) then
        local state = mc.mcCntlGetState(inst);
        if (state == mc.MC_STATE_MRUN_MACROH) then
            mc.mcCntlCycleStart(inst);
            mc.mcCntlSetLastError(inst, "Do Cycle Start");
        else
            if (tonumber(tab) == 0) then 
                scr.ExecMdi('mdi1');
                mc.mcCntlSetLastError(inst, "Do MDI 1");
            else
                scr.ExecMdi('mdi2');
                mc.mcCntlSetLastError(inst, "Do MDI 2");
            end
        end
    elseif tonumber(tab) > 2 then --No G Code or MDI panel is displayed so Do Nothing
        mc.mcCntlSetLastError(inst, "Nothing to Start");
    else --Do CycleStart
        mc.mcCntlSetLastError(inst, "Do Cycle Start");
        mc.mcCntlCycleStart(inst);       
    end
end

Don't concern yourself with the code....I only mentioned it so that you could see in fact there is a bunch of code that runs when you call what looks like such a simple function call CycleStart().

In order that you can hit a remote button and have the cycle start what you want to do is have an input to Mach from the physical button call CycleStart() as if you'd hit the screen button.

In the ESS or PoKeys plugin assign an input pin to the physical button. Then in the Input Signals page in the ESS plugin (presumably the PoKeys plugin is similar but I'm not familiar with it)
connect that pin to a general purpose input signal ISIG_INPUT10 say.

Now you will need to put in the SigLib table an entry to tell Mach we are interested if the signal ISIG_INPUT10 triggers.

Code: [Select]
[mc.ISIG_INPUT10]=function(state)
if state==1 then
CycleStart()
end
end

And THAT'S IT!  If you put that little piece of code into the SigLib table which is at the top of the screenload script you have coded all that is required to have Mach4 monitor an input
and execute a function when the input triggers. How easy is that?

You might have noticed that I attached a second screenshot of the <FeedHold> button. Note that it has a left up action. An action is internal to Mach and the  above method wont work
for that action. I'm sure it can be done but need to think about it a bit more yet.

If in edit screen mode you click on various buttons that about half have either a script or a fuction as an event for which the recipie above will work and the rest have actions as events.
I will do some more thinking and research and get back to you.

Craig

27
my guess is in the code but thats where i fall short

28
light is on an when i touch the two together it gos out but not cycle start or when i flip the active h/l i get it to reverse the light  being off then on when touched either way no go on cycle start,...i tried moving code into the click box an no go

29
Hi,
 try my suggestion and use input #0-#5, then an LED will display on the Machine Diagnostics tab. You can still use port 1 pin 13 but
assign input#2 say to the pin.

Where did you put the code?
[mc.ISIG_INPUT1]=function(state)
   if state==1 then
      CycleStart()
   end
end
Craig

soput 1 in input or 01

30
ive entered the code but changed pin # from 10 to 13 input an it doesn't work,..i tried changing the  active high an low,... still no go  i enabled it under ess as sig 13 cycle start mapped to ess,... an in control under mach its under port 1 pin 13 in tried both act. H/L its also enabled under control,  inputs, enabled under input 13 mapped to ess sig 13 cycle start.... any time i touch wire to +/- doesnt cycle strt,... code as follows



[mc.ISIG_INPUT13]=function(state)
   if state==1 then
      CycleStart()
   end
end

Pages: « 1 2 3 4 5 6 7 8 9 »