Hello I am developing a MIDI controller with a PCB that I have designed, it is not my first full design based on this two microcontrollers for a MIDI device but I am having some troubles with this one.
The problem is that when I program it(only one potentiometer of the 10 that it has to try that it works) it doesn't send the correct MIDI messages to the PC.
I have this on mi 2560
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();
using namespace midi;
void setup()
{
Serial.begin(31250);
MIDI.begin(2);
}
void loop()
{
MIDI.sendRealTime(ActiveSensing) ;
MIDI.read();
int pot1 = analogRead(A0);
int val1 = map(pot1, 0, 1023, 0, 127);
MIDI.sendControlChange(1, val1, 2); //GAIN A // Control Number, Control Value, Channel
int pot2 = analogRead(A1);
int val2 = map(pot2, 0, 1023, 0, 127);
MIDI.sendControlChange(2, val2, 2); //HIGH A
int pot3 = analogRead(A2);
int val3 = map(pot3, 0, 1023, 0, 127);
MIDI.sendControlChange(3, val3, 2); //MID A
int pot4 = analogRead(A3);
int val4 = map(pot4, 0, 1023, 0, 127);
MIDI.sendControlChange(4, val4, 2); //BASS A
int pot5 = analogRead(A4);
int val5 = map(pot5, 0, 1023, 0, 127);
MIDI.sendControlChange(5, val5, 2); //FILTER A
int pot6 = analogRead(A5);
int val6 = map(pot6, 0, 1023, 0, 127);
MIDI.sendControlChange(6, val6, 2); //VOLUME A
}
then it is conected throught serial with the 16U2 that has a MOCO_Lufa bootloader to act like a HIC device.
As I have said it isn't my first MIDI controller that I have made on a PCB, but it is the first that is causing troubles with this.
I have tried only with MIDI.begin(MIDI_CHANNEL_OMNI); then changed it to work only at channel 2, I after added the Serial.begin(31250); because I rode that it could be a sync trouble, I added the MIDI.sendRealTime(ActiveSensing) ; because in a first instance, the MIDI OX Monitor only rode RT messages and anythingat other channels.
I have rechecked all the crystal oscillators and capacitors, but this can't be a problem because I have no problem to upload the sketches to the 2560 or to reburn the bootloader of the 16U2.
So I don't know what can it be or how to solve.
Have anyone experienced something similar?
Thank you so much
Best regards