Hi, I really need som help figuring this one out. I feel stupid, It surley is something very simple that Ive missed.
1:
I got 6 pots connected to Arduino UNO, my program reads the pots, divide results with 8
and sends BYTES with “0xB0” + “potnumber” +“potvalue” (se posted code).
2:
I put the Arduino in DFU-mode and run the USBdevice dot BAT file “makeMidi.bat”.
3:
Arduino shows up as an MIDI-device.
4:
I open Ableton to MAP a Pot to the volume-controller.
5:
Each time i do this It works and map the pot to the volume-slider, but instead of scrolling the volume slider up/down
It changes the pitchbend from 8/16 to 16/16.
6:
Ive tried my own code plus 3 other codes that I found online only to get the same results.
7 :
Ive tried to re-write the midi-message in several ways, Ive tried both “serial.write” and “serial.print” and sending one “empty” byte between
And always get the same results.
My only thougt is that it has something to do with the signal/BYTE being sent in a diffrent way when i turn the arduino into a MIDI-device.
This is the last code I tested, got it online from some forum, anyways:
#include <MIDI.h>
// MIDI enable pin, avoids conflict of Serial between USB for programming and DIN MIDI I/O
#define MIDI_ENABLE 12
// Variables:
int input_nb = 6; // select number of desired analog inputs (max 6)
int AnalogValue[6] = {0,0,0,0,0,0}; // define variables for the controller data
int lastAnalogValue[6] = {0,0,0,0,0,0}; // define the "lastValue" variables
int midiCCselect[6] = {22,23,24,25,26,27}; // select the midi Controller Number for each input (22 to 31 are free)
int thresh[6] = {1,1,1,1,1,1}; // select threshold for each analog input
void setup() {
MIDI.begin(); // MIDI lib, right baud and so on
}
void loop() {
for (int i =0; i < input_nb; i++) {
// My potentiometer gave a range from 0 to 1023:
AnalogValue[i] = analogRead(i);
// convert to a range from 0 to 127:
int cc = AnalogValue[i]/8;
// check if analog input has changed
if (cc != lastAnalogValue[i] ) {
//send control change on cc#i
midiCC(0xB0, midiCCselect[i], cc);
//Serial.println(String(midiCCselect[i])+": "+String(cc));
// update lastAnalogValue variable
lastAnalogValue[i] = cc;
}
} // endfor
}
// sends a Midi CC.
void midiCC(byte CC_data, byte c_num, byte c_val){
Serial.write(CC_data);
Serial.write(c_num);
Serial.write(c_val);
//Serial.print(CC_data);
//Serial.print(c_num);
//Serial.print(c_val);
}
Thank you!