Connections:
To create the midi interface connect the Arduino to a 5pin Din plug as shown. A 220ohm resistor is needed to lower the 5V power.
Code:
From my tests I know the IR sensor reads values from approx. 0 - 600. To create the simple instrument i mapped each of these sensor readings to a MIDI note value (0-127).
The Midi Library provides a simple way to send midi signals.
| void | begin (const byte inChannel=1) |
| Call the begin method in the setup() function of the Arduino. | |
| void | sendNoteOn (byte NoteNumber, byte Velocity, byte Channel) |
| Send a Note On message. | |
| void | sendNoteOff (byte NoteNumber, byte Velocity, byte Channel) |
| Send a Note Off message (a real Note Off, not a Note On with null velocity) |
| void | sendProgramChange (byte ProgramNumber, byte Channel) |
| Send a Program Change message. |
Once MIDI.begin() is send the serial port is used for MIDI and cannot print message to the serial reader. Midi uses a customer Baud rate (31250).
Results:
No comments:
Post a Comment