Detect input while moving

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Detect input while moving

Postby Jeffsg605 » Fri Apr 05, 2019 6:44 pm

I'm just trying to get more familiar with UCCNC. So I'm trying to move my machine and stop when I receive an input signal. This is the code I'm trying:


exec.Code("G91 X1000 F500");
while (exec.IsMoving())
{
if (AS3.GetLED(11))
{
exec.StopWithDeccel();
}
}

However it does not stop when I trigger pin 11 (Port 1 Pin 1). According to this page: (file:///C:/UCCNC/Documentation/LEDs_by_number.htm) pin 11 is Port 1 Pin 1. And I can see on the diagnostic page that the sensor I have connected to Port 1 Pin 1 is indeed switching state when I trigger it. How would I stop the machine with an input signal?

Thanks in advance.
Jeffsg605
 
Posts: 16
Joined: Fri Jan 11, 2019 5:20 pm

Re: Detect input while moving

Postby eabrust » Fri Apr 05, 2019 7:55 pm

Jeffsg605 wrote: And I can see on the diagnostic page that the sensor I have connected to Port 1 Pin 1 is indeed switching state when I trigger it. How would I stop the machine with an input signal?

Thanks in advance.



I think that if you are on Port 1/Pin 1, you want LED 1 (not 11) .

regards
Eric Brust
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 348
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

Re: Detect input while moving

Postby ger21 » Fri Apr 05, 2019 9:56 pm

Setup an Input trigger, with function 130 (Cycle Stop).

You don't need to write a macro.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2663
Joined: Sat Sep 03, 2016 2:17 am


Return to Macros

Who is online

Users browsing this forum: Bing [Bot] and 14 guests

cron