Called when data is available. Use Serial.read() to capture this data. The serialEvent() can be set with Serial.buffer() to only trigger after a certain number of data elements are read and can be set with Serial.bufferUntil() to only trigger after a specific character is read.

[[http://en.wikipedia.org/wiki/MIDI|MIDI]], the Musical Instrument Digital Interface, is a useful protocol for controlling synthesizers, sequencers, and other musical devices. MIDI devices are generally grouped in to two broad classes: controllers (i.e. devices that generate MIDI signals based on human actions) and synthesizers (including samplers, sequencers, and so forth). The latter take MIDI data in and make sound, light, or some other effect.

MIDI is a serial protocol that operates at 31,250 bits per second. The Arduino's built-in serial port (all of them on the Mega as well) can send data at that rate.

MIDI bytes are divided into two types: '''command bytes''' and '''data bytes'''. Command bytes are always 128 or greater, or 0x80 to 0xFF in hexadecimal. Data bytes are always less than 127, or 0x00 to 0x7F in hex. Commands include things such as note on, note off, pitch bend, and so forth. Data bytes include things like the pitch of the note to play, the velocity, or loudness of the note, and amount of pitch bend, and so forth. For more details, see the MIDI specification, or one of the many [[http://hinton-instruments.co.uk/reference/midi/protocol/index.htm|MIDI Protocol Guides]] on the Web.

MIDI data is usually notated in hexadecimal because MIDI banks and instruments are grouped in groups of 16.

For more see this [[http://www.tigoe.net/pcomp/code/communication/midi | introduction to MIDI]] or this [[http://itp.nyu.edu/physcomp/Labs/MIDIOutput |example]].

[[http://en.wikipedia.org/wiki/MIDI|MIDI]], the Musical Instrument Digital Interface, is a useful protocol for controlling synthesizers, sequencers, and other musical devices. MIDI devices are generally grouped in to two broad classes: controllers (i.e. devices that generate MIDI signals based on human actions) and synthesizers (including samplers, sequencers, and so forth). The latter take MIDI data in and make sound, light, or some other effect.

MIDI is a serial protocol that operates at 31,250 bits per second. The Arduino's built-in serial port (all of them on the Mega as well) can send data at that rate.

MIDI bytes are divided into two types: '''command bytes''' and '''data bytes'''. Command bytes are always 128 or greater, or 0x80 to 0xFF in hexadecimal. Data bytes are always less than 127, or 0x00 to 0x7F in hex. Commands include things such as note on, note off, pitch bend, and so forth. Data bytes include things like the pitch of the note to play, the velocity, or loudness of the note, and amount of pitch bend, and so forth. For more details, see the MIDI specification, or one of the many [[http://hinton-instruments.co.uk/reference/midi/protocol/index.htm|MIDI Protocol Guides]] on the Web.

MIDI data is usually notated in hexadecimal because MIDI banks and instruments are grouped in groups of 16.

For more see this [[http://www.tigoe.net/pcomp/code/communication/midi | introduction to MIDI]] or this [[http://itp.nyu.edu/physcomp/Labs/MIDIOutput |example]].

Called when data is available. Use Serial.read() to capture this data. The serialEvent() can be set with Serial.buffer() to only trigger after a certain number of data elements are read and can be set with Serial.bufferUntil() to only trigger after a specific character is read.

* [[Tutorial/SerialCallResponseASCII | Serial Call and Response ASCII]] - send multiple vairables using a call-and-response (handshaking) method, and ASCII-encoding the values before sending.* [[Tutorial/IfStatement | If Statement]] - how to use an if statement to change output conditions based on changing input conditions.

Deleted lines 60-70:

* [[Tutorial/Array]]: a variation on the For Loop example that demonstrates how to use an array.* [[Tutorial/While Loop]]: how to use a while loop to calibrate a sensor while a button is being read.* [[Tutorial/Switch Case]]: how to choose between a discrete number of values. Equivalent to multiple If statements. This example shows how to divide a sensor's range into a set of four bands and to take four different actions depending on which band the result is in.

* [[Tutorial/SerialCallResponse | Serial Call Response]] - send multiple variables using a call and response (handshaking) method.* [[Tutorial/SerialCallResponseASCII | Serial Call and Response ASCII]] - send multiple vairables using a call-and-response (handshaking) method, and ASCII-encoding the values before sending.* [[Tutorial/IfStatement | If Statement]] - how to use an if statement to change output conditions based on changing input conditions.* [[Tutorial/ForLoop | For Loop]]: - controlling multiple LEDs with a for loop.* [[Tutorial/Array]]: a variation on the For Loop example that demonstrates how to use an array.* [[Tutorial/While Loop]]: how to use a while loop to calibrate a sensor while a button is being read.* [[Tutorial/Switch Case]]: how to choose between a discrete number of values. Equivalent to multiple If statements. This example shows how to divide a sensor's range into a set of four bands and to take four different actions depending on which band the result is in.

%color=#7e7e7e%/* %color=#7e7e7e% MIDI note player %color=#7e7e7e% %color=#7e7e7e% This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data. %color=#7e7e7e% If this circuit is connected to a MIDI synth, it will play %color=#7e7e7e% the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence.

%color=#7e7e7e%/* %color=#7e7e7e% MIDI note player %color=#7e7e7e% %color=#7e7e7e% This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data. %color=#7e7e7e% If this circuit is connected to a MIDI synth, it will play %color=#7e7e7e% the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence.

Changed lines 50-53 from:

This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data. If this circuit is connected to a MIDI synth, it will play the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence.

This tutorial on MIDI is still in progress. For more see http://itp.nyu.edu/physcomp/Labs/MIDIOutput

to:

[[http://en.wikipedia.org/wiki/MIDI|MIDI]], the Musical Instrument Digital Interface, is a useful protocol for controlling synthesizers, sequencers, and other musical devices. MIDI devices are generally grouped in to two broad classes: controllers (i.e. devices that generate MIDI signals based on human actions) and synthesizers (including samplers, sequencers, and so forth). The latter take MIDI data in and make sound, light, or some other effect.

MIDI is a serial protocol that operates at 31,250 bits per second. The Arduino's built-in serial port (all of them on the Mega as well) can send data at that rate.

MIDI bytes are divided into two types: '''command bytes''' and '''data bytes'''. Command bytes are always 128 or greater, or 0x80 to 0xFF in hexadecimal. Data bytes are always less than 127, or 0x00 to 0x7F in hex. Commands include things such as note on, note off, pitch bend, and so forth. Data bytes include things like the pitch of the note to play, the velocity, or loudness of the note, and amount of pitch bend, and so forth. For more details, see the MIDI specification, or one of the many [[http://hinton-instruments.co.uk/reference/midi/protocol/index.htm|MIDI Protocol Guides]] on the Web.

MIDI data is usually notated in hexadecimal because MIDI banks and instruments are grouped in groups of 16.

For more see this [[http://www.tigoe.net/pcomp/midi.shtml | introduction to MIDI]] or this [[http://itp.nyu.edu/physcomp/Labs/MIDIOutput |example]]

Changed lines 18-19 from:

An LED connected to pin 9. use appropriate resistor as needed. For most common LEDs, you can usually do without the resistor, as the current output of the digital I/O pins is limited.

to:

All MIDI connectors are female, by definition of the MIDI spec. Here's how to wire the connector to the Arduino: