Problem with sending ControlChange MIDI message with MIDI library

I am using MIDIOX for monitoring purposes. http://www.midiox.com/.
My DAW (Ableton Live 9) is picking up the same signals, and when I connect my MIDI keyboard to MIDIOX, it displays the signal perfectly.
Could it be that my Arduino, for some reason, is sending unclear signal over the PWN pin? To me, this seems the only thing that could possibly be the problem.

If you look on the MIDI to USB converter there is a yellow light that flashes when it receives a MIDI message. I found it would flash only when I turned the pot or when the A/D was toggling between two values.
What happens with this LED on your setup. If it is flashing all the time then your Arduino is the source of the extra messages but if it does not the the messages must be coming from some where else.

The light is only flashing while I'm turning the potmeter. I'm pretty sure the Note On messages are coming from the Arduino, because they're only there when I turn the pot.

I'm pretty sure the Note On messages are coming from the Arduino, because they're only there when I turn the pot.

That is not what you implied earlier. How many of these messages do you get for one control change message.

The light is only flashing while I'm turning the potmeter.

The light indicates something from the Arduino, so if it is not flashing and you are getting a constant stream of the note on messages then the can not be coming from the Arduino.

It is not coming from that code you posted or else I would have seen the same effect. Could it be something in Ableton is triggering note on messages in response to the control change?

Things to try:-

  1. Just have a MIDI monitor active, nothing else MIDI running on your PC.
  2. Change the CC message to another number and see if it still happens.

What I can be certain of is that the code as you posted it does not produce any note on messages. there is noting in the code that says it should and I am not seeing any.

It seems I haven't really been clear. When I reset my arduino, it outputs one CC message, and then when I turn the pot, it gives out Note On messages where it should be giving CC messages.

I always run MIDIOX without Ableton active, and I have also already tried to change the CC number, to no avail.
I'll try to borrow my friend's arduino and test it on there.

I can only repeat that this does not happen when I load in the code you posted. Did you post another version to that which you are using? Try copying the code as you posted it and loading it into your arduino.

Each time I turn the knob I get the yellow LED on the USB / MIDI interface flashes and one CC message appears on my MIDI monitor. What ever your problem it is not with that code you posted. On reset I get one CC message followed by CC messages when ever I turn the knob.

Sorry I don't know what else to suggest.

Do you want to see a video of my setup working?

Is there maybe a way to force the "status" of a MIDI signal? Taking another look at my output, the only real difference between the Note Ons and the CCs are the status; Note On messages have a status of 90, CCs of B4.

I appreciate all the help a lot by the way!

taking another look at my output, the only real difference between the Note Ons and the CCs are the status

Yes that is the only real difference between a lot of MIDI messages.

Is there maybe a way to force the "status" of a MIDI signal?

Yes it is using the call MIDI.sendControlChange as opposed to calling MIDI.sendNoteOn or MIDI.sendNoteOff which is what you are already doing.

I can only think that you might have a screwed version of the MIDI library, try another download and install.
Have you run the example code with the library? Do they work as expected?

Then you might have a damaged arduino, while not impossible is unlikely.

Try this code it does not use the MIDI library

int sensorValueOld = -1;
byte channel = 4 ; // MIDI channel 5

void setup() {
Serial.begin(31250); //start serial with MIDI baud rate 
}

void loop() {
  int sensorValue = analogRead(A0) >> 3; //read potmeter

if (sensorValue != sensorValueOld){ //compare reading to previous reading     
    midiSend(0xB0, 7, sensorValue); //if there is a change, send
}
sensorValueOld = sensorValue;
delay(10);
}

 void midiSend(byte cmd, byte data1, byte data2) {
  cmd = cmd | channel;
  Serial.write(cmd);
  Serial.write(data1);
  Serial.write(data2);
}

After testing almost every single thing that could be wrong with my setup, I took it all to a friend of mine and ran it through his audio interface with a regular MIDI-cable, and it worked perfectly. So both my MIDI cables didn't convert the serial MIDI data to correct USB MIDI data. Now I can finally start building my mixer...

Thanks a ton for all the help!

Great you got it working.

So both my MIDI cables didn't convert the serial MIDI data to correct USB MIDI data.

Was that the MIDI to USB interface you linked to on eBay? It seemed to do the first one correctly.

Yes, they're the ones I linked. It actually works perfectly fine when I use it to connect my MIDI keyboard to my PC, just not for this. Guess I'll have to purchase a decent audio interface.

Hi

exist some way to connect ARDUINO as midi controller via his own usb/power connection in a way to connect 3 push button to several pin to act like midi push button controller ??

You need the helper application "hairless" running on your computer.
That takes serial and sends it on to a MIDI application.