Macro- relay on/off

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

Macro- relay on/off

Postby Mario Soto » Sun Nov 18, 2018 4:13 pm

Hello,
Is it possible to write a macro that would automatically turn on a relay when the z-axis is moving down and off on the up?
Thank you.
Mario
Mario Soto
 
Posts: 40
Joined: Sun Jun 10, 2018 8:24 pm

Re: Macro- relay on/off

Postby extent » Sun Nov 18, 2018 7:40 pm

You could just wire your relay to the direction pin of the z axis stepper driver output
extent
 
Posts: 7
Joined: Wed May 24, 2017 11:09 pm

Re: Macro- relay on/off

Postby ger21 » Sun Nov 18, 2018 9:24 pm

The direction pin doesn't tell you if it's moving or not, just whichever way it moved last.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Macro- relay on/off

Postby extent » Mon Nov 19, 2018 4:20 am

true, but there is no tri-state in "on or off". If you need two relays, on for up and on for down you would need to work out something else, depends on the application.
extent
 
Posts: 7
Joined: Wed May 24, 2017 11:09 pm

Re: Macro- relay on/off

Postby Mario Soto » Mon Nov 19, 2018 2:05 pm

Thank you for the replies. I did not explain correctly in my question. The relay has to stay on until the z changes direction. In other words, the z going down triggers a pneumatic cylinder and stays activated, then releases it when the z moves upward.
Thank you.
Mario Soto
 
Posts: 40
Joined: Sun Jun 10, 2018 8:24 pm

Re: Macro- relay on/off

Postby Mario Soto » Mon Nov 19, 2018 3:16 pm

Would the relay say active when the z is at the bottom but not moving and then go off when it starts to go up?
Mario Soto
 
Posts: 40
Joined: Sun Jun 10, 2018 8:24 pm

Re: Macro- relay on/off

Postby Mario Soto » Mon Nov 19, 2018 7:16 pm

Great! Thank you very much. But you're assuming I'm smart and I'm not! I put the macro in the macro folder. The pin for the breakout board to activate the relay is pin 3 so I take it I would change to 2 in the macro to 3? Do I need to put the macro number in the program? I always used Mach3 and am now changing over to this software. Thank you again.
Mario Soto
 
Posts: 40
Joined: Sun Jun 10, 2018 8:24 pm

Re: Macro- relay on/off

Postby Mario Soto » Mon Nov 19, 2018 9:33 pm

Yes, indeed it does stay on til reversed. ( 07) So now how do we get it to do this when the program is running?
Sorry I did not see the 9091 I will try it next
Mario Soto
 
Posts: 40
Joined: Sun Jun 10, 2018 8:24 pm

Re: Macro- relay on/off

Postby Mario Soto » Mon Nov 19, 2018 10:02 pm

Yes, I think that's it! I'll give it a try on the machine.
Thank you very much!
Mario Soto
 
Posts: 40
Joined: Sun Jun 10, 2018 8:24 pm


Return to Macros

Who is online

Users browsing this forum: No registered users and 6 guests