Hi,
a toggle button is just an on/off switch. In Mach you can make an on-screen button....but there is no requirement that the button be visible. Then you would use something like a physical button
to operate the toggle switch.
Going one step further why have a toggle button at all?. All you require is an output, in the example I gave I chose Output#20 at random. If you look at all of Machs defined output
signals there a hundreds of them, some have a specific meaning and are tied to certain events, but many are just defined signals, they do nothing unless you code them to.
A good example of a defined signal and a predetermined output is:
OSIG_SPINDLEON.
It will go active every time the spindle is turned on. There is to my knowledge any way to change that, its part of Machs DNA.
An example of a defined signal that has no effect is:
OSIG_OUTPUT21.
The signal is defined but it has no specific meaning until you attach some meaning to it. Attaching it to a toggle switch is an obvious example, but by no means the only way it can be used.
ALL of Machs signals, both inputs and outputs have the property that if any one of them change state then the SignalScript runs. Many of Machs signals are internal, say between Mach and a motion
controller and you'll never see them, and some like push button inputs you have contrived yourself.
Imagine you have some macro within your Gcode job and in that macro you assert OSIG_OUTPUT21 thereby changing its state. The SignalScript will run. If there is an entry in the SigLIb table
[mc.OSIG_OUTPUT21] then the function attached to that entry will run. It may apply some logic before turning on yet another output which in turn control a pump.
Look at the SignalScript.pdf that I wrote hopefully to make it a bit clearer.
https://www.machsupport.com/forum/index.php?topic=40051.0The SignalScript and Lua property 'functions as a first class value' offer an incredible leap forward over Mach3 which could only ever poll inputs. Understanding this feature is a key milestone
in coding within Mach4.
Craig