Getting a programatically-controlled, constant 12 V from one of the motor outputs

I'm building a device that requires five 12 V valves to be programmatically controlled as a switch. So far, I have been able to get outputs from the heated bed, extruder, and fan to be controllable through Marlin, by defining "SENSITIVE_PINS" to be an empty array. I can now use M42 to switch these pins on and off, allowing for programmatic control of 3 of the 5 valves.

For the other two valves, I'd like to control these directly from the 3D printer board somehow. I noticed the A4988 driver will rapidly flick a 12 V output on and off according to the microstep setting (https://lastminuteengineers.com/a4988-stepper-motor-driver-arduino-tutorial/). But this type of flicking is not really good for controlling a valve, because I want the valve to remain open until I say "stop".

What I would like is to be able to use the M42 to command to administer a 12 V output on or off from the motor section of the usual boards. The A4988 driver takes in inputs like Enable, Step, and Dir from Arduino pins. Is there any way I can "hack" the A4988 driver to provide a constant voltage, similar to a relay switch? Alternatively, can I remove the driver and do something with the female pins that are normally used to connect to the A4988 driver?

In researching this I have noticed that when removing the driver, you expose some more 12 V female and GND pins on your board, which can provide an easy connection to a third-party relay or h-bridge. But ideally, I would be able to do this without adding any new hardware to the board.

This question is on-topic because it has to do with 3D printer boards that are currently on the market and because it is ultimately a device that is used to 3D print something.

• Use the enable pin, you can solder a wire directly to it. You control it by giving any movement command and by disabling that stepper output. The same applies to the direction pin: give a movement in a direction to turn it on, send a movement in the opposite one to turn it off
– FarO
Apr 24, 2020 at 20:07
• @FarO The enable pin doesn't give out 12V so that doesn't address the problem. You can also just use M42 to address the pins directly. Apr 24, 2020 at 20:57