Hi jossa,
I think your sensors are PNP (output switches to + supply) which are unlike Ben's sensors that were NPN (output switches to GND).
But good point if you are willing to add an external resistor to invert the drive they might work. I couldn't find a spec on your sensor to see how much current they can drive. But consider this circuit. The resistor keeps KSTEP's opto LED on. But when the PNP sensor drives the output high it will supply the current to the resistor and turn off the KSTEP's opto LED.
Attachment 262000
Regarding EStop: That User had a EStop signal input into Input bit 1046 in his system. He defined the symbol ESTOP to represent the number 1046 so that his code would be more readable instead of just using the number 1046. It also has the advantage that if the number is used many places he can just redefine the symbol and automatically everywhere the symbol is used will now use the new value.
The code reads the defined input and passes the result to a function called Debounce. The Debounce function does two things: #1 it "debounces" the switch because most mechanical switches do not always make a clean perfect switch on and off, but actually bounce where the switch closes and opens rapidly for a few milliseconds before finally settling out into a fully open or closed state. #2 it detects not when the switch is active or inactive, but rather when it changes state to active or inactive. The function takes care to return a value of 1 one and only one time when the switch settles into an active state.
There is also a function call of: DoPC(PC_COMM_ESTOP); The function DoPC sends a numeric code up to the PC running KMotionCNC to tell it to do something. In this case it is requesting to push the STOP button. This will in turn disable all the axes channels and abort the GCode Interpreter if it is running.
Both of these functions must be copied and included into your C program. The Debounce Function can be copied from the ExternalButtons.c example. The DoPC function can be copied from the KFLOPtoPCCmdExamples.c
HTH
Regards
TK