Pages: [1]   Go Down
Author Topic: Trouble sending MIDI out from TX pin  (Read 652 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to send MIDI notes from the TX pin (#1).

Here's my circuit, although I'm not using the piezos and the switches - just the MIDI socket:
http://todbot.com/blog/2006/10/29/spooky-arduino-projects-4-and-musical-arduino/

And here's my code:
int ledPin = 13;                 // LED connected to digital pin 13

void setup(void) {
  // initialize inputs/outputs
  // start serial port
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
  Serial.begin(31250);              // set baud rate to MIDI
}

void loop(void) {
  // Send 10 MIDI notes on/off ascending chromatically from middle C, each lasting one second
  // with a one second delay between each, flashing the LED on each note sent
  int i;
  for(i=0;i<10;i++) {
    digitalWrite(ledPin, HIGH);   // sets the LED on
    Serial.print(0x90, BYTE);
    Serial.print(i+60, BYTE);
    Serial.print(64, BYTE);
    delay(1000);
    digitalWrite(ledPin, LOW);    // sets the LED off
    Serial.print(0x80, BYTE);
    Serial.print(i+60, BYTE);
    Serial.print(0, BYTE);
    delay(1000);
  }
}

When the arduino is connected to the USB port, the TX/RX LEDs flash showing transmission. When I connect the TX pin to the MIDI socket and disconnect the USB cable, the TX/RX pins no longer flash and there are no MIDI codes sent, at least none that MIDI-OX (a MIDI monitor program) can see.

I noticed this post:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1161023163/2#2
which discusses changing the FTDI driver to allow the 31250 baud rate, and I made the change suggested to FTDIPORT.inf, but it didn't help.

Do the same signals appear on the TX pin as are sent out the USB port? Or do I have to somehow disable the FTDI chip and reroute the serial signals to the TX/RX pair of pins? I have also tried "pinMode(1, OUTPUT)" to make sure the TX pin is an output, but that didn't help either.

Can anyone tell me why the USB port is transmitting but not the TX pin, when I do a "Serial.print" command?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's working now. The pins in the circuit above:
http://todbot.com/blog/2006/10/29/spooky-arduino-projects-4-and-musical-arduino/

are reversed. Or at least I was interpreting them as looking at them from the solder lug side and not the front. For what it's worth to anyone wanting to use that circuit, wire the MIDI jack as if you're looking at the front, not the solder lugs.

Sorry for the false alarm.
Logged

Pages: [1]   Go Up
Jump to: