Hello Guest it is March 28, 2024, 12:20:55 PM

Author Topic: Needing help with screens  (Read 17781 times)

0 Members and 1 Guest are viewing this topic.

Offline dude1

*
  •  1,253 1,253
    • View Profile
Needing help with screens
« Reply #20 on: December 03, 2014, 09:31:40 PM »
yer should of put in what I have tried

below works with out mc.mcAxisSetPos(inst, 0, 0.000) or mc.mcMotorSetHomePos(inst,0,0); -- inst, 0= X axis , 0 = set to home anything else is counts per unit

if I add one or the other of the above codes it stops the output turning off and the axis`s don't go to zero.

I put them in after gcode execute

--Laser Zero
--Get the instance of the controller
local inst= mc.mcGetInstance();

mc.mcCntlGcodeExecute(inst, "G1 X10 Y10 F500");--run some g-code

--Get the out5 handle
local out5= mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT5);
--Output TOGGLE
 local outstate = mc.mcSignalGetState(out5);
 if (outstate == 1) then
   mc.mcSignalSetState(out5, false);
 else
   mc.mcSignalSetState(out5, true);

 end

Offline BR549

*
  •  6,965 6,965
    • View Profile
Needing help with screens
« Reply #21 on: December 03, 2014, 09:39:35 PM »
It worked here zeroed out the XY after the Gcode move

mc.mcAxisSetPos(inst, 0, 0.000)
mc.mcAxisSetPos(inst, 1, 0.000)

Offline dude1

*
  •  1,253 1,253
    • View Profile
Needing help with screens
« Reply #22 on: December 03, 2014, 09:54:41 PM »
did you try it like this did it turn your output 5 on

Code: [Select]
--Laser Zero
--Get the instance of the controller
local inst= mc.mcGetInstance();

mc.mcCntlGcodeExecute(inst, "G1 X10 Y10 F500");--run some g-code

mc.mcAxisSetPos(inst, 0, 0.000);
mc.mcAxisSetPos(inst, 1, 0.000);

--Get the out5 handle
local out5= mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT5);
--Output TOGGLE
 local outstate = mc.mcSignalGetState(out5);
 if (outstate == 1) then
   mc.mcSignalSetState(out5, false);
 else
   mc.mcSignalSetState(out5, true);

 end

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Needing help with screens
« Reply #23 on: December 03, 2014, 10:26:13 PM »
Have you setup output5 in config?

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Needing help with screens
« Reply #24 on: December 03, 2014, 10:37:14 PM »
I cannot set up output 5 in the DEMO. BUT I did setup output3 and ran this code and it turned ON the output3.

 --Laser Zero
--Get the instance of the controller
local inst= mc.mcGetInstance();

mc.mcCntlGcodeExecute(inst, "G1 X10 Y10 F50");--run some g-code

mc.mcAxisSetPos(inst, 0, 0.000);
mc.mcAxisSetPos(inst, 1, 0.000);

--Get the out3 handle
local out3= mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT3);
--Output TOGGLE
 local outstate = mc.mcSignalGetState(out3);
 if (outstate == 1) then
   mc.mcSignalSetState(out3, false);
 else
   mc.mcSignalSetState(out3, true);

 end

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Needing help with screens
« Reply #25 on: December 03, 2014, 10:45:31 PM »
I am get output 5 on and off its just not zeroing x an y after move
« Last Edit: December 03, 2014, 10:53:54 PM by daniellyall »

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Needing help with screens
« Reply #26 on: December 03, 2014, 10:47:03 PM »
Now the real kicker is IF I load the code and run it once it runs ok. IF I then run it a 2nd time it runs the Gcode twice in a row(0 -10/0, 0-20/0, CRASH) . IF I run it the third time it locks up mach4.

Probably a SIM() problem, (;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Needing help with screens
« Reply #27 on: December 03, 2014, 10:48:28 PM »
(;-) Its not doing ? what?

(;-) TP

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Needing help with screens
« Reply #28 on: December 03, 2014, 10:55:12 PM »
I will try in virtualmotion

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Needing help with screens
« Reply #29 on: December 03, 2014, 11:16:37 PM »
See if this bit works as expected. If it does, you can then build on it. I would work on one bit at the time.

Code: [Select]
local inst = mc.mcGetInstance();
mc.mcCntlGcodeExecute(inst, "G1 X10 Y10 F50");--run some g-code
wx.wxMilliSleep(10);
mcState = mc.mcCntlGetState(inst);
while (mcState ~= mc.MC_STATE_IDLE) do
mcState = mc.mcCntlGetState(inst);
wx.wxMilliSleep(10);
end
mc.mcAxisSetPos(inst, 0, 0.000)
mc.mcAxisSetPos(inst, 1, 0.000)
mc.mcAxisSetPos(inst, 2, 0.000)
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!