Hello Guest it is May 15, 2021, 08:13:11 PM

Author Topic: Map Lua Code to ShuttlePro button  (Read 6343 times)

0 Members and 1 Guest are viewing this topic.

Offline Pedio

*
  •  200 200
    • View Profile
Re: Map Lua Code to ShuttlePro button
« Reply #20 on: May 27, 2016, 02:07:51 PM »
It seems the m3 code does not compile every time. I even shut down M4 and restart it and it does not work. Do I need to reboot the computer?

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Map Lua Code to ShuttlePro button
« Reply #21 on: May 27, 2016, 02:16:00 PM »
Delete the ones with the extension MCC and delete the mcLUA.MCC

DazTheGas
Theres always time for a choccy biccy

Offline Pedio

*
  •  200 200
    • View Profile
Re: Map Lua Code to ShuttlePro button
« Reply #22 on: May 27, 2016, 04:31:33 PM »
The program tells me that it can not find the m3.mcc file even when restart M4. I am removing the .mcc file and M4 seems to remake mcLUA but not the m3. Suggestions?

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Map Lua Code to ShuttlePro button
« Reply #23 on: May 27, 2016, 05:49:12 PM »
Check that theres no error in the script or it wont compile

DazTheGas
Theres always time for a choccy biccy

Offline Pedio

*
  •  200 200
    • View Profile
Re: Map Lua Code to ShuttlePro button
« Reply #24 on: May 29, 2016, 12:15:13 PM »
I hate being ignorant but that rarely stops me...

I got the script to work with the button on the ShuttlePro; however, it comes on with the last set spindle speed. I looked for LUA codes in the scripting manual but did not find them. Is it as easy as adding a line to my script that states:

mc.mcSpindleSetSpeed (1)

???? I would like to set the power level at 1 for the spindle speed.

Offline Pedio

*
  •  200 200
    • View Profile
Re: Map Lua Code to ShuttlePro button
« Reply #25 on: May 29, 2016, 03:02:46 PM »
This is driving me crazy - the good news is it is a very short trip!

I found the correct (I think) command for setting the laser power. I tried this:

function M3()
     inst=mc.mcGetInstance()
     mc.mcCntlSetLastError(inst, 'Spindle Clockwise')
     mc.mcSpindleSetDirection (inst, 1)
     mc.mcSpindleSetCommandRPM(inst, 1 )
end
if (mc.mcInEditor()==1) then
   m3()
end

Did not work. Then I thought it may need the RPM before the command to turn on so I moved it - still does not work. Dang

I know I should be testing these before I use them, but not sure how? For example, I have this code on a button and it works well, but I don't seem to be able to get it to work elsewhere.

local inst = mc.mcGetInstance();
local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON);
local sigState = mc.mcSignalGetState(sigh);

if (sigState == 1) then
    mc.mcSpindleSetDirection(inst, 0);
else
    mc.mcSpindleSetDirection(inst, 1);
    local rpm = 1;    -- Set this to the actual RPM you want as your starting point
    mc.mcSpindleSetCommandRPM( inst, rpm );
end

I would like to achieve the same function with a ShuttlePro button. I don't mind reading about how to do this, but I don't know where. Also, I would rather not learn LUA to set a ShuttlePro button.

Alms for the confused???

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: Map Lua Code to ShuttlePro button
« Reply #26 on: May 29, 2016, 03:31:57 PM »
I cant see anywhere in your code where you have actually turned the spindle on??

try   


Code: [Select]
mc.mcSpindleSetCommandRPM(inst, 1 )
mc.mcSignalSetState (mc.mcSignalGetHandle (inst, mc.OSIG_SPINDLEON),1)
mc.mcSpindleSetDirection(inst, mc.MC_SPINDLE_FWD);

DazTheGas
Theres always time for a choccy biccy