Machsupport Forum

Mach Discussion => Brains Development => Topic started by: Thom2000 on November 18, 2018, 09:41:51 AM

Title: Brain writing on/off relay
Post by: Thom2000 on November 18, 2018, 09:41:51 AM
Hello,
I could use some help writing a brain.
I need to output a signal to a relay.
On when Z moves down and off when it moves up.
Any suggestions would be very helpful.
Thank you.
Mario
Title: Re: Brain writing on/off relay
Post by: TPS on November 19, 2018, 03:30:51 AM
something like this might work
Title: Re: Brain writing on/off relay
Post by: Thom2000 on November 28, 2018, 02:12:41 PM
Sorry I missed your reply. My email isn't forwarding replies.
Thank you for your interest in my problem (which is mine as you say).
How do I install this brain into the brain folder?
It is a PNG file.
It looks more complicated than I first thought but would love to try it.
Thank you again,
Mario
Title: Re: Brain writing on/off relay
Post by: TPS on November 28, 2018, 02:27:48 PM
ok, i am sorry to have this brain file thrown away.

you have to rebuild it of the screenshot.

it you have Trouble, let me know, then i will do a new brain file
Title: Re: Brain writing on/off relay
Post by: ZASto on November 28, 2018, 05:28:06 PM
Here is, recreated :)
Title: Re: Brain writing on/off relay
Post by: Thom2000 on November 28, 2018, 10:13:08 PM
Hello,
I tried to write it in the brain editor but just do not have enough experience at this time. Your help would be very much appreciated.
(Love your cars!)
Title: Re: Brain writing on/off relay
Post by: Thom2000 on November 28, 2018, 11:06:00 PM
Okay, getting close.
The Z down movement turns on the relay.
But when the z reverses upwards, it stays on.
Could you please take a look,
Thank you again,
Mario
Title: Re: Brain writing on/off relay
Post by: TPS on November 29, 2018, 02:18:01 AM
i have tested the brain here, it works fine.
Title: Re: Brain writing on/off relay
Post by: Tweakie.CNC on November 29, 2018, 05:15:03 AM
Another possibility you may wish to consider…

The Z axis Direction Pin state is modal, it will have one state when (and after) the Z axis has moved in one direction and the opposite state when (and after) the Z axis has moved in the other direction. The Z axis Direction Pin could then be used to switch an Output# ON or OFF without using Brains.

Tweakie.
Title: Re: Brain writing on/off relay
Post by: Thom2000 on November 29, 2018, 07:56:32 AM
Of course, you tested it before sending. It was late and I didn't see I had another brain enabled that kept the relay on.
So I was a man with 2 brains!  >:D
Thank you for all your help.
Also, I would like to try the Tweekie approach.
If I use pin 3 for Z direction and have pin 3 OUTPUT # 1, pressing Z down should turn on the relay.
But it doesn't so I must have missed something.