So I'm having a lot of trouble with the programming side of things, and I'm not sure I have my output wired correctly, but it's wired according to
http://arduino.cc/en/Tutorial/Midi. I attached a picture of what my whole bread board looks like. and my code so far looks like this:
#include <MIDI.h>
/*
Sustain pedal
Reads a digital input on pin 4, chooses between sustain and sostenuto
Reads a digital input on pin 2, outputs to midi information
*/
// declare inputs.
int toggleSwitch = 4;
int togglePedal = 2;
int midiOut = 1;
// the setup routine runs once when you press reset:
void setup() {
// initialize midi
MIDI.begin(1);
// make the switch pins inputs:
pinMode(toggleSwitch, INPUT);
pinMode(togglePedal, INPUT);
pinMode(midiOut, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input pins:
int switchState = digitalRead(toggleSwitch);
int pedalState = digitalRead(togglePedal);
// output out the state of the pedal:
if (pedalState == 0 && switchState == 0) //sustain off
{MIDI.sendControlChange(64,0,1);}
if (pedalState == 1 && switchState == 0) //sustain on
MIDI.sendControlChange(64,127,1);}
if (pedalState == 0 && switchState == 1) //sostenuto off
{MIDI.sendControlChange(66,0,1);}
if (pedalState == 1 && switchState == 1) //sostenuto on
{MIDI.sendControlChange(66,127,1);}
delay(1); // delay in between reads for stability
}
I had it working when I outputted it to the serial monitor to debug, but I have no clue how to use the midi.