Wait for external signal before executing G-Code command
I'm using the Repetier Firmware on an Arduino Due along with the RADDS Board. However, the Arduino only controls an extruder and not the stepper motors for the respective axes or a heated bed. The Arduino receives a binary signal from the outside via a pin.
My goal is to have the extruder execute the next G-code command every time there's a signal change from the outside. Even if it's just a G0 command and it doesn't extrude, it should "execute" the command upon the signal change. While waiting for a new signal, the extruder should maintain temperature and extrusion speed. Ideally the board should not wait for feedback from the extruder (as in the case of the M109 command). It should blindly execute the commands as soon as a signal comes from outside.
Where in the code do I write that a new G-code command should be executed upon a new signal? I've been unsuccessful so far.
Thanks in advance!