Build your own MIDI circuits
FAQ
Frequently Asked Questions.
Details
 
MIDI & Music
MIDI and Music Information
Details
 
MIDI IN & OUT Software

 

MIDI IN/OUT Arduino Software

 

To set Arduino Pins D2 and D3 to provide +5 Volt and 0 Volt(GND), incclude these lines in: 

void setup() { 

 

pinMode(2, OUTPUT); 
pinMode(3, OUTPUT); 
digitalWrite(3, LOW); // GND 0 Volt supply to opto-coupler
digitalWrite(2, HIGH); // +5 Volt supply to opto-coupler

 

 To set Arduino Pins D4, D5, D6 and D7, connected to the 4-way DIL switch,  to select the MIDI Channel (1 to 16), incclude these lines in:

 void setup() { 

 

pinMode(4, INPUT); // Set Inputs for 4 way DIP Switch
pinMode(5, INPUT); 
pinMode(6, INPUT); 
pinMode(7, INPUT); 
digitalWrite(4, HIGH); // Set inputs Pull-up resistors High
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);

  

 

And in the main programme: 

void loop () { 

 

// Read 4-way DIP switch
MIDIchannel=digitalRead(4) + (digitalRead(5)<<1) + (digitalRead(6)<<2) + (digitalRead(7)<<3); 

 

 

 

Download:

Open the  source code file and copy and paste it into the Arduino programme and save it as a .PDE file