I could use some help creating a function and I believe I need a macroloop to get it to work the way I want. I am still barely literate in macro language, despite everyone's assistance over the years here.
I'm attempting to create a pulsing (on, wait, off, wait, repeat) output on a particular pin for an air 'blast' system. I created something similar using a simple timer relay on a different machine and it was extremely useful in clearing chips out of deep pockets - even more so than flood coolant or a continuous air nozzle. This time I'd rather use a software solution.
The solenoid valve is currently activated by a relay via Port 3, Pin 2. So far I can can get the pin to cycle on & off, and the timing is adjustable from within the macro:
(M2002)
exec.Setoutpin(3,2);
exec.Wait (1000);
exec.Clroutpin (3,2);
exec.Wait (1000);
If I call the macro number via MDI or assign a button number it runs once. If I add it to the macroloop it will run continuously (oviously) with no way to turn it off except theough the macroloop configuration window.
What I want is to be able to activate/deactivate it using an M-code and/or a physical input pin.
So...
1. How do I get the macro to monitor a button state and then loop the above function? Ideally this would be a toggle-type function, as I have a single NO push button that is not assigned to another function.
2. Is it possible to map this pulsing loop to the M8 (flood) function? That would be really nice as my post processor would take care of enabling it ('flood cooling' for pockets), and would simplify the pushbutton and on-screen button assignment. The router doesn't have flood coolant, so there's no loss of function if M8 is turned in to an air blast thing.
Thanks in advance for any guidance,
-Ralph