Go Down

Topic: Still unable to send CC using MIDI Library (Read 12174 times) previous topic - next topic

MikiL

Hello! I'm doing Midi Controller and have tested many different codes to get it work Code in this topi works perfect. But I have trouble to get another potentiometer connected... If I mod the code like this

Code: [Select]


#include <MIDI.h>

// Variables:
int cc_potikka1 = 0;
int AnalogValue_potikka1 = 0; // define variables for the controller data
int lastAnalogValue_potikka1 = 0; // define the "lastValue" variables

int cc_potikka2 = 0;
int AnalogValue_potikka2 = 0; // define variables for the controller data
int lastAnalogValue_potikka2 = 0; // define the "lastValue" variables

void setup() {
  //  launch MIDI
  MIDI.begin(4);

 
}

void loop()
{
AnalogValue_potikka1 = analogRead(0);
AnalogValue_potikka2 = analogRead(1);
//  convert to a range from 0 to 127:
cc_potikka1 = AnalogValue_potikka1/8;
cc_potikka2 = AnalogValue_potikka2/8;
// check if analog input has changed

if (lastAnalogValue_potikka1 != cc_potikka1)
{
MIDI.sendControlChange(16,cc_potikka1,1);
// update lastAnalogValue variable
lastAnalogValue_potikka1 = cc_potikka1;
}  //  endif

if (lastAnalogValue_potikka2 != cc_potikka2)
{
MIDI.sendControlChange(17,cc_potikka2,2);
// update lastAnalogValue variable
lastAnalogValue_potikka2 = cc_potikka2;
}  //  endif
}


and try to mapping that my software (Traktor) and using those as pitchfaders, Traktor move both faders sametime, doesn't matter which fader I touch. Can somebody explain me how this need to change to get it work right?

Go Up