Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
These are some code examples to support the MIDI Basics column in the April 2012 issue of Popular Science. They're simple, but they should be enough to get you going with MIDI and an Arduino. If you make some well commented examples of your own that you'd like to include here, please fork the repository and issue a pull request. If possible, please use the same circuit or one based upon the demo circuit used here so that these examples can all run on the same hardware. These examples are written assuming you are using the Sparkfun MIDI Shield or an equivalent circuit with the same pin connections (e.g. momentary pushbutton connected to digital pin 2). Build that shield with stackable Arduino headers and connect a Serial LCD to +5V, GND, and D5 on the shield. Shield - http://www.sparkfun.com/products/9595 Headers - http://www.sparkfun.com/products/10007 Serial LCD - http://www.sparkfun.com/products/9395 If you are building your own circuit, you can build a MIDI interface circuit based on this schematic: http://www.midi.org/techspecs/electrispec.php If you are building the MIDI IN side with a 6N138 Optoisolator instead of the PC-900, replace the MIDI IN part of the above with this: https://github.com/vinmarshall/Radio-Shack-MIDI-Lights/blob/master/schematic/1_MIDI.bmp The Sparkfun MIDI Breakout Board is also good for prototyping: http://www.sparkfun.com/products/9598 NOTE: Remember to set the Midi (Run) / Program switch to "Program" before trying to upload a program to the Arduino. The Examples: Chordinator: * This code will read Note On and Note Off messages on Channel 1 * arriving at the MIDI IN port and play a Chord built on each of * those notes to the MIDI OUT port. Connect the MIDI OUT of your * keyboard to the MIDI IN of the Arduino and the MIDI OUT of the * Arduino to the MIDI IN of the keyboard. Control Change: * This code will send Control Change (or PitchBend, or * Aftertouch, etc...) messages based on the position of the * potentiometer every time it's position changes. This is just * a simple demo designed to get you up and running with MIDI. Play Notes: * This code will send Note On and Note Off messages on Channel 1 * based on the position of the potentiometer when the button is * pressed. This is just a simple demo designed to get you up and * running with MIDI. Read Notes: * This code will read Note On and Note Off messages on Channel 1 * arriving at the MIDI IN port. This is just a simple demo designed * to get you up and running with MIDI. Controlling Relays with MIDI: Look at my "MIDI Lights" project for an example of using MIDI notes to control a series of relays: https://github.com/vinmarshall/Radio-Shack-MIDI-Lights