31
Mach4 General Discussion / How to stop the spindle motor in M6 script?
« on: August 04, 2019, 04:54:59 PM »
I believe I need to use mcSpindleSetCommandRPM, however, the cryptic way the API help is written it never just tells you exactly what code to use. So how do I turn this information into something that actually works?
This does not work:
mcSpindleSetCommandRPM
C/C++ Syntax:
int mcSpindleSetCommandRPM(
MINSTANCE mInst,
double RPM);
LUA Syntax:
rc = mc.mcSpindleSetCommandRPM(
number mInst,
number RPM)
Description:
Set the commanded RPM for the spindle.
Parameters: Parameter Description
mInst The controller instance.
RPM A double specifying the RPM.
Returns: Return Code Description
MERROR_NOERROR No Error.
MERROR_INVALID_INSTANCE The mInst parameter was out of range.
Notes:
None.
Usage:
// Set the spindle RPM to 5000.
MINSTANCE mInst = 0;
int rc = mcSpindleSetCommandRPM(mInst, 5000);
This does not work:
Code: [Select]
rc = mc.mcSpindleSetCommandRPM (inst, 0)
and neither does this:Code: [Select]
int rc = mcSpindleSetCommandRPM(inst, 0)
mcSpindleSetCommandRPM
C/C++ Syntax:
int mcSpindleSetCommandRPM(
MINSTANCE mInst,
double RPM);
LUA Syntax:
rc = mc.mcSpindleSetCommandRPM(
number mInst,
number RPM)
Description:
Set the commanded RPM for the spindle.
Parameters: Parameter Description
mInst The controller instance.
RPM A double specifying the RPM.
Returns: Return Code Description
MERROR_NOERROR No Error.
MERROR_INVALID_INSTANCE The mInst parameter was out of range.
Notes:
None.
Usage:
// Set the spindle RPM to 5000.
MINSTANCE mInst = 0;
int rc = mcSpindleSetCommandRPM(mInst, 5000);