Hello Guest it is April 28, 2024, 02:20:46 AM

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 - Cbyrdtopper

871
Mach4 General Discussion / Re: Lua While Loops
« on: October 21, 2015, 10:35:16 AM »
Ya-Nvr-No
Good deal, so calling the declared output "hsigCar" means that later when you want to turn it on or off you just need to mc.mcSignalSetSate(hsigCar, 0 or 1). 

DazTheGas
I still don't know much about the RC stuff, I learned a little bit about it at the CNC workshop but just what it is not how to use it.  I don't know when you use it or what to use it for.

872
Mach4 General Discussion / Re: Lua While Loops
« on: October 21, 2015, 10:13:36 AM »
Thank you Ya-Nvr-No!
I see what you mean by declaring variables multiple times, Didn't even realize I was doing that, I just copied and pasted top to bottom. 
When I get A signal handle I can name it whatever I want?  I do not have to use hsig, It is just a variable at that point, I noticed you used "hsigCar", just to show you that it is the handle on the carousel output.  Is that correct?

873
Mach4 General Discussion / Re: Lua While Loops
« on: October 21, 2015, 09:49:56 AM »
Thanks DazTheGas!!
Thanks for taking the time to help out!! I really appreciate it!  I didn't realize you could join commands on 1 line either.  This command will help out a lot with Air Cylinders also I'm thinking.

on this line... "local Carousel =  mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.OSIG_OUTPUT1),1)"  You have combined SetState with GetHandle just by using "( )"?  Is this correct?

874
Mach4 General Discussion / Lua While Loops
« on: October 21, 2015, 08:41:37 AM »
Here is some code that I have to move my tool carousel forward with a gear motor.  It moves forward until it hits a switch and then will turn off.  Likewise on the return.
I have no ability to test this macro in real time right now.  But could someone let me know if I have all of my syntax correct?  Thanks!!
-Chad

function m1003()

------
--Tool Carousel Forward
------
local Carousel = mc.OSIG_OUTPUT1 -- Carousel output, turning it on.
local hsig = mc.mcSignalGetHandlem (inst,Carousel)
mc.mcSignalSetState(hsig,1)

------
--Check for switch
------
local Input1 = 0; --Tool carousel is forward.
local hSig = 0;

hSig = mc.mcSignalGetHandle(inst,mc.ISIG_INPUT1);
Input1 = mc.mcSignalGetState(hSig);

while (Input1==0) do
     mc.mcCntlSetLastError(inst, "Carousel Moving Forward");
end

-----
--Turn off motor
-----
local Carousel = mc.OSIG_OUTPUT1 -- Carousel output, turning it off.
local hsig = mc.mcSignalGetHandlem (inst,Carousel)
mc.mcSignalSetState(hsig,0)

end

if (mc.mcInEditor() == 1) then
   m1003()
end

875
Mach4 General Discussion / Re: Lua GcodeExecute
« on: October 07, 2015, 03:33:17 PM »
Thanks Chaoticone!! That did the trick.  Just needed ".." instead of ","
Works Great!! =)

876
Mach4 General Discussion / Lua GcodeExecute
« on: October 07, 2015, 11:04:26 AM »
I am wanting to execute g code using a variable.  In Mach3 you were able to do this easily but I can't figure out how to do it in Lua.
Here is the macro below.  The macro retrieves the reg val just fine but the part I'm concerned with are lines 8 and 9.  I have set the variable to my reg val.  Now how do I use the variable in the g code line. 


N01  function m1020() --Test
N02  --Macro to move programable coolant nozzle.
N03  --using registers for nozzle positions.
N04  inst = mc.mcGetInstance()
N05  hreg = mc.mcRegGetHandle(inst,"gRegs0/Test1")-- Position 1 2.5
N06  val = mc.mcRegGetValueString(hreg)
N07  val = tonumber(val)
N08  local ProgCoolant = val
N09  mc.mcCntlGcodeExecuteWait(inst, "G90G00C", ProgCoolant)
N10  end
N11  if (mc.mcInEditor()== 1) then
N12      m1020()
N13  end

877
General Mach Discussion / Re: MPG Mode won't stay on.
« on: June 24, 2015, 03:36:26 PM »
SUCCESS!!!  I have figured out the problem!!  I am using a Pokeys board.  Under the configure pokeys there is a check box on the bottom saying something about step and direction are needed to enable the MPG.  I just turned it off and my pendant works again!!

878
General Mach Discussion / Re: MPG Mode won't stay on.
« on: June 22, 2015, 01:55:44 PM »
Learned what shuttle mode is.  I am still not having any luck with this.  I have a new XML and when I make the necessary changes to get the machine working the MPG still won't turn on inside mach 3.

879
General Mach Discussion / MPG Mode won't stay on.
« on: June 03, 2015, 08:41:32 AM »
I have a 4 axis MPG pendant.  I am using a brain to turn on Jog Mode ---> MPG when the MPG pendant is switched to any of the axis "X,Y,Z, or A"; respectively when I switch the MPG pendant to "OFF"  the brain switches to Jog Mode ---> Cont. 
I know this brain works because I am using it on 2 other machines.  However, on this machine when I switch to an axis on the pendant it switches to MPG mode for a split second and switches back to Cont.  When I manually hit tab and cycle through the jog modes it doesn't switch to MPG Mode.  I have MPG 1 active in the ports and pins so it should at least toggle to MPG Mode but it is not. 
Side note, I do not know what shuttle mode is, but whenever i enable it it switches to MPG mode but it will not allow me to use the MPG Wheel.   ANY IDEAS???

-Chad

880
Mach4 General Discussion / Re: MPG Setup ????
« on: May 29, 2015, 12:44:09 PM »
Thanks TimGS!  I'll give it a look.  I'll be able to do some testing when I'm finished with a machine I'm working on.  I really want to get Mach 4 put on it.  Still have a little ways to go to get an understanding of Mach 4 and especially Lua.