Hello Guest it is April 13, 2021, 01:35:15 PM

Author Topic: Feedrate and Spindle Speed Override LEDs  (Read 910 times)

0 Members and 1 Guest are viewing this topic.

Feedrate and Spindle Speed Override LEDs
« on: April 02, 2018, 09:03:45 AM »
When I'm machining something and I override the Feedrate or Spindle RPM, I sometimes forget to change it back.
I liked how Mach3 had the flashing LEDs whenever the Feed or Spindle were not at 100%.   So I added a couple of LEDs to the screen in the Feedrate and Spindle control boxes to do the same thing.

I used two options of code to get this to work; either set the screen property to "1" for the LED or link the LED to an Output and toggle it on or off.

PLC Script
--Override LEDs whenever Feedrate and Spindle are not at 100%.
--local inst = mc.mcGetInstance()
local FRO = mc.mcCntlGetFRO(inst) --Returns:  0 - 250
local SSO = mc.mcSpindleGetOverride(inst) --Returns:  0.5 - 1.5
local FROLED = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT60)
local SSOLED = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT61)

if FRO ~= 100 then
     scr.SetProperty("FROLED", "Value", "1")         --Screen Property Example
     scr.SetProperty("FROLED", "Value", "0")

if SSO ~= 1 then
     mc.mcSignalSetState(SSOLED, 1)         --Output Example
     mc.mcSignalSetState(SSOLED, 0)
Chad Byrd