Closed drewm1980 closed 10 years ago
I've only tested on an Arduino Leonardo myself, but another user reported it working on an Arduino Micro.
Have you tried with a loop like this yet? The loop in the example only sends a not back whenever it receives a note (I should add better examples, as another user also noted).
void loop() {
while(true) {
MIDIEvent e_on = {0x09, 0x90, 48, 64};
MIDIEvent e_off = {0x08, 0x90, 48, 64};
MIDIUSB.write(e_on);
MIDIUSB.flush();
delay(500);
MIDIUSB.write(e_off);
MIDIUSB.flush();
delay(500);
}
}
void setup() {}
void loop() {
MIDIEvent e_on = {0x09, 0x90, 48, 64};
MIDIEvent e_off = {0x08, 0x90, 48, 64};
MIDIUSB.write(e_on);
MIDIUSB.flush();
delay(500);
MIDIUSB.write(e_off);
MIDIUSB.flush();
delay(500);
}
Yay! Note ON works for the above example! I mistook the purpose of MIDIUSB.available() to be that the ~interface was available, not that a ~message was available. I think it might be less confusing if it was MIDIUSB.message_waiting() or something like that....
Note OFF isn't getting sent yet, but I probably just need to double-check the bytes in the message (maybe 0x8 isn't note off?)
Great to know it's working. Try this for note on/off:
int channel = 0;
MIDIEvent e_on = {0x09, 0x90 | channel, 48, 64};
MIDIEvent e_off = {0x08, 0x80 | channel, 48, 64};
void setup() {}
void loop() {
MIDIEvent e_on = {0x09, 0x90, 48, 64};
MIDIEvent e_off = {0x08, 0x80, 48, 64};
MIDIUSB.write(e_on);
MIDIUSB.flush();
delay(500);
MIDIUSB.write(e_off);
MIDIUSB.flush();
delay(500);
}
Yep, that works! Thanks! The ORing wasn't necessary; it was that I had changed 0x90 to 0x80 thinking it was a channel input that should be the same for both notes.
I can confirm it's working with: Freeduino Leonardo Arduino Micro
Thanks for the feedback. I expanded the examples in the readme now.
I am having trouble sending MIDI notes to the PC:
The device show up in lsusb I managed to Upload the following sketch:
My configuration: Ubuntu 13.10
arcore: commit 2086a7ab4bb36fc2a56a8060a79f154b0e909bda Merge: 4ffdabc a6eeb1c Author: Ralf Kistner ralf@embarkmobile.com Date: Mon Jan 13 01:33:15 2014 -0800 Merge pull request #4 from stepto/master Added iPad compatibility via extra board type.
arduino-1.5.5 running as root Pianoteq STAGE Trial v4.5.4
Same behavior on an older Freeduino Leonardo, and also a brand new Arduino micro.
Thanks! I'm very excited to be so close to getting this working!