Buen dia a todos
Mi problema es el siguiente, estoy haciendo un proyecto para un MIDI foot controller para usarse en programas como bias fx o guitar rig y cuando intento probar la señal en MIDIBerry o pocketMIDI el mensaje de salida se repite infinitamente.
Estoy usando un arduino leonardo con unos switches 3PDT
adjunto codigo
#include <MIDIUSB.h>
int estadoboton = 0;
const int boton = 3;
int estadoBoton;
int estadoBotonAnterior;
void controlChange(byte channel, byte control, byte value) {
midiEventPacket_t event = {0x0B, 0xB0 | channel, control, value};
MidiUSB.sendMIDI(event);
MidiUSB.flush();
}
void noteOn(byte channel, byte pitch, byte velocity) {
midiEventPacket_t noteOn = {0x09, 0x90 | channel, pitch, velocity};
MidiUSB.sendMIDI(noteOn);
MidiUSB.flush();
}
void noteOff(byte channel, byte pitch, byte velocity) {
midiEventPacket_t noteOff = {0x08, 0x80 | channel, pitch, velocity};
MidiUSB.sendMIDI(noteOff);
MidiUSB.flush();
}
void setup() {
// put your setup code here, to run once:
Serial.begin(31250);
pinMode(boton, INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
estadoboton = digitalRead(boton);
if(estadoboton != estadoBotonAnterior){
controlChange(0, 5, 127);
}
else{
controlChange(0, 5, (byte)0x00);
}
estadoBotonAnterior=estadoBoton;
}
asi se veria en pocketMIDI
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 00
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
B0 05 7F
¿Hay alguna solución?
Un cordial saludo.