hello,
i've been working on this project for a month or so now, and not really getting anywhere with it. in the past i've mainly used my arduino board for LED control and for switching reed relays on and off, but now i'm trying(unsuccessfuly) to get arduino to listen to incoming midi messages from an external sequencer.
having looked arround the web, i've decided to use a common schematic that is also available from Toms site.
its the top schematic, for midi in.
i have a bread board with the parts set up, and the serial out from the 6n138 chip is connected to the RX pin of my arduino board.
at the moment, all i'm trying to do is get the board to listen for a midi signal and switch on pin 13, where i have an led connected, but so far its just not working.
i have tried loads of different variations of code, heres an example, which was modified from the basic serial read tutorial.
int ledPin = 13; // select the pin for the LED
int val = 0; // variable to store the data from the serial port
void setup() {
pinMode(ledPin,OUTPUT); // declare the LED's pin as output
Serial.begin(31250); // connect to the serial port
}
void loop () {
// read the serial port
val = Serial.read();
if (val != -1) {
if (val == 0x90, 0x01, 0x45 ) { // note on, channel 1, note value 1, velocity 45
digitalWrite(ledPin, HIGH);
delay(200);
digitalWrite(ledPin, LOW);
}
}
}
i have a midi signal being sent from ableton live, through my usb midisport 2x2 and into the bread board. from there it goes through the 6n138(and the relevant diodes and resistors) to the RX pin of the arduino board. the board isnt connected via usb, and is powered from a wall adaptor.
the RX and TX leds on the board are lighted up(but very dim) but i just cant seem to get any sort of response. i can see that the Midisport is receiving the signal from ableton as its got indicator leds to show when a signal is received and sent.
so, does any one have any ideas or tips that might get this working? it would be greatly appreciated!!
thanks,
bod.