Hi Dude1 and Joeaverage, I am feeling a bit dumb as I couldn’t find this thread and so had to start another to ask this question. Then today I realised I could just go to my own profile and find it from there.
Thanks for your help guys, I have gone off and had good success using your suggestions and bits and pieces that you posted as well as some other scripts that had been uploaded in the past.
I still have very little to no idea with Lua, but have learned quite successfully how to copy and paste bits from here and there. I have most exterior buttons talking to Mach4 now and even a couple of potentiometers for Feed Rate Override and Spindle Speed Override working just as they should. Almost.....
Would either of you know how to express a percentage range in this line below?
local percent = analog/1*250 ‐‐Calculate percentage from 0% to 250%
It comes from a tutorial that Matevž from PoLabs did about how to connect up the pot to the Pockeys board and then map it to Mach4 as an analog input for the FRO.
For the FRO, 0 to 250% is good, but for the Spindle OVR I need it to be 50% to 150%. So there is a percentage range from 50 to 150 and I can’t get it happening. The 150 is easy, currently when the pot is full CW it hits 3.3 Volts and the slider in Mach hits the top, but it’s the other end of travel that is the challenge.
For some reason with the Spindle speed it must be expressed as a decimal percentage, e.g. 0.5 to 1.5. But how to write it in the correct way in the above line?
The full script is in the attached pdf. Or this is the link to it just in case you have any interest.
http://blog.poscope.com/mach4-tutorial-fro-using-analog-input/Any suggestions are welcome. Thanks again guys
Regards,
Craig.