It depends on what you are using to do the task.
If all this is done using a button click or an M command macro then the VB behind the button or in the M macro can do this. It can fire the output and then turn on your LED, or wait for the input to trigger and turn on the LED.
If the input is turned on by an outside control that Mach did not start then the code has to go in the macropump, then Mach will run the macropump vb code about 20 times a second and check the inputs and do what ever your code tell it to do.
Graham.