I'm working with transferring MIDI serial data and processing it with an Arduino. However, the Serial Monitor built into the Arduino IDE cannot run at the proper baud rate that MIDI data is transferred at- 31250 bps. There are programs like Snoize's MIDI Monitor, but I was wondering if there is any workaround or patch for the IDE's monitor.
Thanks!
NOt that I know of, you may use an extern program as putty that can set any baudrate.
Problem will be that MIDI is coded binary so a terminal program that interprets these codes as characters will not be very usefull. A midi monitor as the one you refer to makes more sense imho as this interpretes the data.
Ah, I understand. I thought I might be able to print the incoming data to the monitor as HEX or something similar, because I'd need to see how it comes through to the Arduino... But I suppose I see how using something meant for MIDI makes sense.
What you can do is let the Arduino capture the midi (NewSoft Seraial @31250) and send it in HEX to the serial monitor @115200
NOte HEX takes 2or 3 bytes to represent one byte, therefor the faster baudrate is needed to keep up
Thanks! But what code could I use to read and print serial data at different baud rates?
You can't read and print from the same port at two different rates. That's why it was suggested that you use two different ports/methods, for the two purposes.
I just set up the arduino mega 2650 which allows up to four uart terminals
I have not quite got MIDI running reliably on the Uno yet so I can't promise anything. IBut it works
void setup() {
Serial.begin(9600);
Serial1.begin(31250); // set MIDI baud rate
{
// and then replaced the Serial.writes with Serial1.writes
void midiMsg(byte status0, byte data1, byte data2) {
Serial1.write(byte (status0));
Serial1.write(byte (data1));
Serial1.write(byte (data2));
You may also try to add a format specifier:
Serial1.write(byte(data1), HEX);
and please don't forget to put your code within code tags, the # button.
[added] as pointed out below, the code is wrong and the suggestion misguided ![]()
why would you use a format specifier when writing a byte to a serial port ? That makes no sense.
michinyon:
why would you use a format specifier when writing a byte to a serial port ? That makes no sense.
You are right. I was still thinking of the problem of monitoring the output on a terminal window.
You are right. I was still thinking of the problem of monitoring the output on a terminal window.
You might want to do a little research, and figure out exactly why that code compiles, and exactly what it WILL do. Not what you intended, that's almost a certainty.
PaulS:
You might want to do a little research, and figure out exactly why that code compiles, and exactly what it WILL do. Not what you intended, that's almost a certainty.
Oh please, I already edited my original comment, what else should I say to express my genuine repentance =(?
Oh please, I already edited my original comment, what else should I say to express my genuine repentance
Nothing. I just wanted you to understand what the change you suggested would actually accomplish. It does something.