Machsupport Forum

Mach Discussion => Brains Development => Topic started by: Jimmyalenius on December 25, 2014, 05:55:38 PM

Title: Brain that activate laser when spindle goes negative Z?
Post by: Jimmyalenius on December 25, 2014, 05:55:38 PM
Hi! I have mounted a relay that goes on and off using code M08 for ON and M09 for OFF (coolent on/off). When I want to start the laser I put M08 in my g-code. But that solution gives a lot of manual editing. It have to be another way to control the relay? I have seen some solutions on Youtube that use the negative Z for switching the relay on (https://www.youtube.com/watch?v=Bmx0OxR8EMg). Is that possible using brain, and is there some example code to learn from?

Regards / Jimmy
Title: Re: Brain that activate laser when spindle goes negative Z?
Post by: dude1 on December 25, 2014, 06:56:29 PM
what do you wont the laser to do
Title: Re: Brain that activate laser when spindle goes negative Z?
Post by: Jimmyalenius on December 26, 2014, 11:19:43 AM
Hi! I want to turn the laser on and off, depending on the position off the spindle. A positive value turn the laser off (M09) and a negative value turn the laser on (M08). The relay I use to control the laser is connected to the breakout card (P14 and +5V).

Regards / Jimmy
Title: Re: Brain that activate laser when spindle goes negative Z?
Post by: dude1 on December 26, 2014, 02:16:45 PM
have a search through here for what you wont it there
you could also do changes to your post processor to add a M8 at start and M9 at end
Title: Re: Brain that activate laser when spindle goes negative Z?
Post by: Jimmyalenius on December 26, 2014, 02:35:15 PM
Hi! I have done a search at the forum but can't find what I'm looking for. Right now I do it manually in the post precessing, but my question was about if this could be done with a brain.
Title: Re: Brain that activate laser when spindle goes negative Z?
Post by: dude1 on December 26, 2014, 03:57:40 PM
there are easier ways of doing what you wont to do search for laser on off
Title: Re: Brain that activate laser when spindle goes negative Z?
Post by: Jimmyalenius on December 27, 2014, 11:35:00 AM
Ok, now I made a Brain that switch the laser on and off depending if the Z axis is positive or negative. It's a simple and fast solution. Now I need to figure out a way of turning the laser off in both positive AND negative Z value until I hit start i Mach3. Is there a command for start and stop?