Machsupport Forum

Mach Discussion => Brains Development => Topic started by: Skateboss on March 28, 2013, 08:49:07 PM

Title: External switch to activate custom m code
Post by: Skateboss on March 28, 2013, 08:49:07 PM
Hi everyone, so I have just hooked up an arduino to mach3 using 'modbus' and have written a vbscript for a custom button, but cant seem to figure out a way to have the external switch activate my m664.m1s...
if anyone can show me how, it would be much appreciated

regards Chris
Title: Re: External switch to activate custom m code
Post by: Chaoticone on March 29, 2013, 11:25:22 AM
Hey Chris,  Welcome to the forum!

Can you have the arduino turn an led on and off and have the script in the macropump monitor that led?

Maybe you could run the macro with a brain?

http://www.machsupport.com/forum/index.php/topic,7175.msg46854.html#msg46854

Brett
Title: Re: External switch to activate custom m code
Post by: Skateboss on March 29, 2013, 12:07:30 PM
Hi Brett,
Thanks for the welcome  ;D
I tried that earlier and it didnt seem to work.... Basically what I have done is added an led to the feed hold button (in the software) and one to the stop button, what I want to do is make the external feed hold led flash when its paused, my brain / vbscript make this work perfectly when i click the on screen feed hold, but not when I press the external button.

yes the external LED's / switches work perfectly :-D

is there anyway of changing what 1001(feed hold) code does?

Chris
Title: Re: External switch to activate custom m code
Post by: Chaoticone on March 29, 2013, 01:08:22 PM
OK, best I can tell is leds 80, 805 and 111 are associated with feedhold.  Put those leds on a screen and lable them thier respective number 80,805,111 and see which one/s turn and turn off when you want your hardware light to blink/stop blinking.

Watch it/those in a brain..... and blink your hardware light based on it/those.

You cant change what the 1001 code does.  You may be able to use it in script and add functrions in that script but last I played with it, it was pretty feniky.  Would prefer doing the feed hold as a function and monitor those leds.  I think 805 will be the one but not certain.


Brett
Title: Re: External switch to activate custom m code
Post by: Skateboss on March 29, 2013, 01:37:43 PM
thanks Brett, I will play :D

although I have been playing all day and cant seem to get it to work, I can get it to stay on permanently if i use 805 but need to get it to blink on and off.

using the blink option in the editor doesn't help as this seems to be to do with the animation rather than what the led is doing.

maybe something to add in a future version is a lobe terminator option to directly execute macropumps????
Title: Re: External switch to activate custom m code
Post by: Chaoticone on March 29, 2013, 01:51:34 PM
Can you add a timer to your brain?

Nope, macropump doesnt work like that.  It either runs all the time or doesnt depending on weather or not you have it enabled in general config.  Its like a script button some magic monkey is pushing for you 10 times a second (that monkey is fast too).  Brains can run much faster than that and you can get yourself in a mess if you make an infinate loop and other no, nos in the macropump code.


Brett
Title: Re: External switch to activate custom m code
Post by: Skateboss on March 29, 2013, 01:52:50 PM
do timers cycle over and over or just run once? because that would be an option

Chris
Title: Re: External switch to activate custom m code
Post by: Chaoticone on March 29, 2013, 01:56:33 PM
Over and over if single shot is unchecked.  Edited my last reply too......

Brett
Title: Re: External switch to activate custom m code
Post by: Skateboss on March 29, 2013, 02:07:56 PM
You my friend are made of the same stuff as legends  ;D

OMG I cant believe I sat here all day trying to write code etc etc, and timers were there all along lmfao

THANK YOU THANK YOU THANK YOU HEHE  ;D ;D ;D ;D ;D

Chris
Title: Re: External switch to activate custom m code
Post by: Chaoticone on March 29, 2013, 02:11:12 PM
 ;D

Just got lucky....... LOl

brett
Title: Re: External switch to activate custom m code
Post by: Overloaded on March 29, 2013, 03:18:50 PM
You my friend are made of the same stuff as legends  ;D
........... just not necessarily in the proper proportions or order. ;D
Russ
 :D

 >:D
Title: Re: External switch to activate custom m code
Post by: Chaoticone on March 29, 2013, 03:22:47 PM
 :-*  Love you too Russ.    ;D

Brett