With apologies if this is irrelevant or a "red herring", but I had a similar problem when I first tried to make an Arduino MIDI decoder.
In General settings/General configuration wizard make sure you have enabled MIDI output, and in General settings make sure you have ticked the appropriate MIDI out boxes.
It is more straightforward if you use NOTE ON/OFF messages rather than PROGRAM CHANGE messages to activate Hauptwerk’s on-screen stops and couplers.
In Organ settings, configure:
Primary output as
Auto MIDI output (match to primary input settings) and
MIDI OUT port as the
actual port that your MIDI decoder is connected to, rather than the default
<All enabled ports>.
Important: In order to detect Hauptwerk’s MIDI out messages you need to connect, by means of a real or virtual MIDI cable, the MIDI OUT port that Hauptwerk is using to the MIDI IN port that your detection software (eg MIDI-OX) is using (and that yourArduino will eventually be using).
It took me a while to realise that simply configuring MIDI-OX to display MIDI output does not work.
Incidentally, I recommend using real MIDI cables rather than virtual MIDI cables to minimise possible “MIDI loop” issues with Hauptwerk.
HTH
Graham