Hey,

I might need a little assistance here.
It's been a while since my programming classes, but I kinda sorta got the hang of it again to the point that I can usually get a functional macro after some good ol' trial and error.
Wrote me a couple macros for finding edges/centre/top of workpiece and to make tool changes a breeze and all that, to make life easier.
Took a while and some cursing here and there, but I figured it out by doing some reading on the forums.

Anyways, my current problem is that - more often that not - Mach3 stops and says that a limit switch was triggered, despite being way clear of all the limit switches.
I suspect either a faulty switch or broken wiring.
Problem is, I have not been able to replicate the fault by wiggling on cables whatsoever.

Since most of the wiring is "inside" of the machine, it'd a pain to check by measuring or by replacing switches to find the fault.
So I figured I could just go and add a couple LEDs (one for each limit switch) on my main screen and have them switch on (and stay on, until manually reset!),
once the corresponding limit switch is triggered.



For the start,
I reckon it'd be best to write a looped macro and add this to the start-config instead of using macropump (which pauses between the runs, afaik?)?

Now I began just writing a very basic script like this (828 being the OEM Code for the X++ Limit switch LED; 1828 being the User LED that I want to switch on):

If GetOEMLed(828) = 1 Then
SetUserLed(1828, 1)

End If


But this does not work for "GetOEMLed(828) = 1", to test it, I just ran the script while pressing the limit switch,
but if I set it to "= 0", it does work (not pressing the switch then, of course).


So with my rusty and basic programming knowledge,
this is where I am stuck already. Couldn't find any useable information via searching the internet, unfortunately




Now how do I get my UserLed to turn on once the corresponding OEMLed turns on?

Similar Threads: