I have a code snipet that sends notes to usbMIDI and uses Serial.print() to follow the progress.
I upload the program and open the debugging window. I expect it to print
Instead I see
And then nothing. The teensy apparently hangs.
If I then run a program that listens to MIDI, then the code continues running and everything is fine.
If I uncomment the "Serial.println(vol)" lines, then the program continues running and the output is as expected.
It's puzzling. Anyone else seen this? I am building on a Mac. Any ideas of how to fix this problem? Ideally, I don't want to put Serial.print statements all over the program.
As a second question, is there any way to know if a program is actually connected to MIDI?
Code:
void setup() {
Serial.begin(57600);
delay(3000);
Serial.println("setup");
}
const int maxv = 127;
void loop() {
static uint8_t note = 65;
note++;
Serial.println("start");
usbMIDI.sendNoteOn(note, 64, 1);
for(int vol=0;vol<=maxv;vol++) {
//Serial.println(vol);
usbMIDI.sendControlChange(7, vol, 1);
delay(10);
}
Serial.println("mid");
for(int vol=maxv;vol>0;vol--) {
//Serial.println(vol);
usbMIDI.sendControlChange(7, vol, 1);
delay(10);
}
Serial.println("sent");
delay(10);
}
I upload the program and open the debugging window. I expect it to print
Code:
setup
start
mid
sent
start
....and so forth
Instead I see
Code:
setup
start
And then nothing. The teensy apparently hangs.
If I then run a program that listens to MIDI, then the code continues running and everything is fine.
If I uncomment the "Serial.println(vol)" lines, then the program continues running and the output is as expected.
It's puzzling. Anyone else seen this? I am building on a Mac. Any ideas of how to fix this problem? Ideally, I don't want to put Serial.print statements all over the program.
As a second question, is there any way to know if a program is actually connected to MIDI?