Hey Everyone!
I am new to the forum. Figured after reading and getting so much help from all the topics, that I should share with people what I am working on. For my senior project, me and several other students designed and built a 30 foot laser cutting machine. Absolutely massive. I am using Mach4 to get it going. I wanted to get some feedback on some of the coding that I have stirred up. Let me know if I am wayyyy off or if it looks just about right. The laser has to receive three outputs in the order given below. The M codes will be called out in the post and should be run at every pen down and pen up from the cam program. I am using a Hicon Integra board as well. The board I am setting up today and that is why I have not tested yet. If the code is right, then I am happy I posted it for everyone to share if they need to make something similar happen.
When M101 is called:
1) Turn on gas (output 3)
2) Open shutter (output 2)
3) pause for 0.25 seconds
4) Enable beam (output 1)
Code for M101:
function m101()
local inst= mc.mcGetInstance();
local out1= mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1);
local out2= mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2);
local out3= mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT3);
mc.mcSignalSetState(out3, true);
mc.mcSignalSetState(out2, true);
wx,wxMicroSleep(250);--250ms delay
mc.mcSignalSetState(out1, true);
end
When M102 is called:
1) Disable beam (output 1)
2) pause for 0.25 seconds
3) Close Shutter (output 2)
4) Turn gas off (output 3)
Code for M102:
function m102()
local inst= mc.mcGetInstance();
local out1= mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1);
local out2= mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2);
local out3= mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT3);
mc.mcSignalSetState(out1, false);
wx,wxMicroSleep(250);--250ms delay
mc.mcSignalSetState(out2, false);
mc.mcSignalSetState(out3, false);
end