Connecting a Midi Keyboard to a relay board

Hi,

I’m trying to connect a Midi Keyboard (Alesis V61) to an Arduino Mega 2560 which is linked to a relay board of 13 solenoids, so that each key on the keyboard will send an on/off signal to the relay board. My idea is to control a set of solenoids that will be powered for as long as I hold a key on the keyboard. I have tried using Hairless Midi and that makes the Arduino RX led flash every time I press and release a key, but I don’t know if it gives an output from the Arduino. Is there a code I need to upload to the Arduino to direct a note ‘C4’ to digital output 22, and ‘C4 sharp’ to 23, ‘D4’ to 24 etc. because I haven’t found one yet.

My final idea is to be able to have a pipe organ which valves are controlled by the solenoids and the midi keyboard can be used to control the valves for each pipe.

Could someone please point me in the right direction on how to make the Arduino interpret the Hairless midi signals? Attached is a photo of me playing an octave chromatic scale and the output it gives on Hairless.

Many thanks,

Samuel

Ok, so I tried the first code from the link https://forum.arduino.cc/index.php?topic=529787.0 and the Arduino sends a signal from pin 13. How do I configure the code to send this output via different pins for each individual note?