ok, I got it to work briefly but then I unhooked the RX input and when i put it back it no longer works. I used this:
//variables setup
byte incomingByte;
int statusLed = 13; // select the pin for the LED
//setup: declaring iputs and outputs and begin serial
void setup() {
pinMode(statusLed,OUTPUT); // declare the LED's pin as output
Serial.begin(31250); //start serial with midi baudrate 31250 or 38400 for debugging
digitalWrite(statusLed,LOW);
}
void loop () {
if (Serial.available() > 0) {
incomingByte = Serial.read();
// wait for as status-byte, channel 1, note on or off
if (incomingByte==144){ // 144 is note on ch1
digitalWrite(statusLed, HIGH);
delay(20);
digitalWrite(statusLed, LOW);
delay(1);
}
}
}
This is how I got it to work ... uploaded this sketch (for like the 20th time) and it didnt work...no surprise.
then I took the lead from pin 5 of the opto and directly touch pin 2 on the atmega( the rx pin) then I stuck a 1k resistor between therx and tx sockets, removed it and then put the lead from pin 5 of the opto back into the rx socket. Ta-DA that did it ...worked fine! However... After I removed the input lead and put it back it stoped working and now nothing. I checked continuity.... I think everything is good. I get a strong beep when the probes are directly on the opto's output and the atmega RX pin 2. I am pretty sure the hardware is ok. I think somehow my arduino doesnt want to read incoming data, though it loads sketches fine.