Hallo,
ich habe ein Problem mit einem Projekt. Ich möchte mit einem Arduino Due über dem nativen USB Eingang MIDI Daten von meinem E-Piano empfangen und damit einen LED-Streifen (WS2812B) steuern. Im Prinzip genau dieses Produkt. (Link: Piano LED Plus – Piano Led Shop)
Nun zu meinem Problem, ich bekomme einfach keinen Input, egal was ich mache. Ich habe diverse Bibliotheken ausprobiert und keine führte zum Erfolg. Ich mache anscheinend irgendetwas falsch. Mein Setup wäre folgendes. Der Arduiono Due ist über den programming port mit dem PC verbunden, und mein E-Piano (Alesis Recital Pro) ist über den nativen USB port mit dem Arduino verbunden. Zum Testen habe ich diverse “read/input” sketches der Bibliotheken (MIDIUSB, MIDI, MIDI Libary, USBH_MIDI) probiert, nichts funktionierte.
Ich habe mich die letzten Tage sehr damit beschäftigt und gefühlt das ganze Internet durchstöbert, aber ich bekomme es einfach nicht zum laufen.
Das Einlesen des MIDI Inputs über MIDI-OX, falls das E-Piano mit dem PC verbunden ist, funktioniert.
Hier eines der Versuche, das MIDIUSB_read sketch mit einer LED als Kennzeichnung, ob ich Input bekomme oder nicht.
/*
* MIDIUSB_test.ino
*
* Created: 4/6/2015 10:47:08 AM
* Author: gurbrinder grewal
* Modified by Arduino LLC (2015)
*/
#include "MIDIUSB.h"
#define LED_PIN 22
// First parameter is the event type (0x09 = note on, 0x08 = note off).
// Second parameter is note-on/note-off, combined with the channel.
// Channel can be anything between 0-15. Typically reported to the user as 1-16.
// Third parameter is the note number (48 = middle C).
// Fourth parameter is the velocity (64 = normal, 127 = fastest).
void noteOn(byte channel, byte pitch, byte velocity) {
midiEventPacket_t noteOn = {0x09, 0x90 | channel, pitch, velocity};
MidiUSB.sendMIDI(noteOn);
}
void noteOff(byte channel, byte pitch, byte velocity) {
midiEventPacket_t noteOff = {0x08, 0x80 | channel, pitch, velocity};
MidiUSB.sendMIDI(noteOff);
}
void setup() {
pinMode(LED_PIN, OUTPUT);
Serial.begin(115200);
}
// First parameter is the event type (0x0B = control change).
// Second parameter is the event type, combined with the channel.
// Third parameter is the control number number (0-119).
// Fourth parameter is the control value (0-127).
void controlChange(byte channel, byte control, byte value) {
midiEventPacket_t event = {0x0B, 0xB0 | channel, control, value};
MidiUSB.sendMIDI(event);
}
void loop() {
midiEventPacket_t rx;
do {
rx = MidiUSB.read();
if (rx.header != 0) {
digitalWrite(LED_PIN, HIGH);
}
} while (rx.header != 0);
digitalWrite(LED_PIN, LOW);
}
Ich hoffe Ihr könnt mir weiterhelfen.
LG Rene