MIDI Control Change Messages not working

Hi there, I've built a Arduino circuit, with a number of POTs which I am attempting to send MIDI ControlChange messages with. When I connect it up to Logic Pro or other DAWs it behaves peculiarly, jumping from 0 to 127 rather than smoothly moving between them.

The MIDI section of my code looks something like this:

byte midiMap0 = (analogVal0,0,1023,0,127);//map to 7-bit midi value range
MIDI.sendControlChange(16,midiMap0,1);//(control number, control value, channel)

Can anyone see where I am going wrong?

Thanks

Dear Userman123,

Can you please put the rest of the code
and could you show a diagram connection of your Pot
it would be easier to help you

Best Regard,

Xarolium

Hey, dont mean to hijack this thread but i kind of have a similar problem.

Iv'e been lurking around this board for quite some time now and had alot of fun with the Arduino over the last couple of weeks (mainly controlling leds in different ways, automating them e.t.c)
until i came across an Instructable where someone built an Arduino based Midi Controller (http://www.instructables.com/id/Arcade-Button-MIDI-Controller/).

I thought i might give that a shot, downloaded the code and it worked right out of the box.
But downloading a code doesnt mean you learn anything about the stuff you are building so i wrote i simple sketch to read one pot wich then sends a serial message through usb to my serial - midi converter.

int potval = 0;

void setup() {
Serial.begin(31250);
}

void loop(){
potval = analogRead(0)/8;
midiCC(1,16, potval);
}


// This function sends a Midi CC.
void midiCC(char channel, char control, char value){
Serial.print(channel, BYTE);
Serial.print(control, BYTE);
Serial.print(value, BYTE);
}

Looks simple but it doesnt work.
When i fire up serial - midi and then use the learn function in traktor it sends alot of different notes on different channels and the RX on s2midi is blinking red (which should mean that the serial signal is faulty and can't be converted right)

I really want to understand the way the signal has to be put out to make it midi compatible, so there has to be something i completely missunderstood here.

Can anyone help me out here?

regards
Patrick

p.s: I'm using an DFRduino atmega1280

//eidt:
by the way, to the guys who already built stuff like this:
How is the input latency on something like this and how does it deal with rapid fader movements?

Ok i managed to fix the problem. The main thing was that the analogvalue wasnt devided right because of a typo.
Here is what i came up with:

int control = 0;
int controlstore = 0;

void setup() {
Serial.begin(31250);
}

void loop(){
control = analogRead(0) / 8;

if(control != controlstore){
 Serial.print(0xB0, BYTE);
 Serial.print(1, BYTE);
 Serial.print(control, BYTE);
  controlstore = control;
}}

Tried it out and it worked well, the next thing is that i have to figure out a way to send 14bit midi control change messages because pitchfaders need a really high resulution.
Has anybody done that before?

regards