Hi,
since this function is just switching the fwd and rev relays to rev and fwd. it is really a mach4 function
and it does not work
No, that is not quite correct. Mach4 has output
signals SpindleOn, SpindleFwd, and SpindleRev.
Whenever your Gcode has a m3, m4 or m5 one or more of the signals will change.
But note, the are SIGNALS only, they don't do anything. If you want them to turn your spindle on and off they must, with
the motion control plugin, be connected to output pins of your motion controller. A signal becomes an input or output ONLY
when the signal is connected to a pin.
--set output here the question is do i have to get state first or can i just turn it on
No, you can just turn it on, you will have to get its handle. For example:
local ouputHandle=mc.mcSignalGetHandle(inst,mc.OSIG_OUPUT30)
mc.mcSignalSetState(outputHandle,1)
- I want it to stay on until the input changes state
Thats the whole point of using the SigLib{} table, the entry [mc.ISIG_INPUT6] will ONLY EVER be executed when it changes state,
if it does not change the the outputs will remain in their current state UNTIL the entry is executed by a change of Input#6.
Craig