Thank you for the prompt answer. Are there any examples of something like this available?
The machine will be controlled by its control, fanuc, Mazak ect. Ill end up writing a macro that will direct an m code(in the machine control, not lcnc) to actuate a relay, which in turn will send a signal to the RPI to start the indexing . The program in the lcnc will be an mcode that calls a component, although, i may just be able to actuate the pallet changer with out any cnc (on the pi side) g or m codes at all. Its kinda similar to a toolchanger i did a few years ago, except the toolchanger was all hydraulic.
It was proposed to control the pallet changer from the machine, i saw it as an expensive proposition and the idea of programming it ladder---ugh, plus no gui. Im making progress with the RPI3 and ive kept a log of what it takes to do the image, patch the kernel and load machinekit. As soon as i successfully get the spi working, I was thinking about proposing a Wiki page .