You must launch this method in the setup() function of the Arduino, it enables I/O communications on the serial port, which means you don't need to use Serial.begin(31250). You can also define the pin number for powering the input optocoupler, and set the fast transmission mode.
The parameters are described on the library main page.
This method generates and sends a MIDI message described by the parameters.
eg. MIDI.send(NoteOn,12,42,1) will send a NoteOn message on channel 1, for the note #12 with a velocity of 42.
This method reads the serial input of the Arduino to check if there are some MIDI messages matching the Filter condition. When a valid MIDI message is detected, it is stocked into a structure, so you can access it outside the library for your applications.
It reads only one message at the time, if you expect more than one message, multiple calling of MIDI.read and saved messages stocking is advised.
When you call this method, it will erase the previously saved message in the structure, even if there are no new message to save.
If you plan to use an external powering (not a pin) for the optocoupler, be sure to use the MIDI.useExternalPowerPin method before calling MIDI.read, to enable MIDI input communications.
This is a combination of MIDI.read and MIDI.send.
This method first looks for a MIDI message wih MIDI.read, then if one is found AND thru mode enabled, sends it back on the MIDI out with MIDI.send. The message remains in the memory structure if you want to use it.
If the thru mode is active, every message (on every channel, filtering comes later) is mirrored to the output. Then the channel filtering is processed, and if a valid message is found, it returns true.
Checks whether a valid MIDI message is saved in the structure.
Returns true if the message is valid, false if it's not.
Returns the type of the MIDI message. You can use the types defined above for comparison in your sketch.
Returns the channel of the MIDI message.
Returns the first byte of data embedded in the message.
Returns the second byte of data. If the message is a PC or a ATCanal (a 1 data byte message), the returned value is 0.
Sets the fast transmission mode on or off (default on).
Sets the optocoupler power pin high to enable hardware MIDI input.
Sets the optocoupler power pin low to disable hardware MIDI input.
Defines the pin handling the optocoupler power for hardware MIDI input.
Use this method if you want to power the optocoupler externally (without an Arduino pin), you may not have control on hardware MIDI input, but you save yourself a pin.. Remember that MIDI.read is disabled if no optocoupler pin has been declared (with MIDI.begin(Opto,..) or this method).
Set the thru mode on.
Set the thru mode off.
Set the thru mode to the indicated value.