Go Down

Topic: simple 6 pot arduino midi-over-USB-controller problem (Read 1 time) previous topic - next topic

lobj10

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  or CC notes from 1-127 depending on if im using arduino MIDI liberary or MIDI liberary that comes with USBdevicewin.
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.

What am I doing wrong????


With following code i get a fast respond in ableton and I can map my 6 pots to different channels,  but instead of change the volume that I mapped it to it change MIDI CC notes.

Code: [Select]

//#include <MIDI.h>
#include <usbDevices.h>

#define numPots 6  // numer of pots
#define b 1        // this is the delta needed in

unsigned int currentPot[6] = {0,0,0,0,0,0};   
unsigned int pot[6] = {0,0,0,0,0,0};
byte controlChange = 0xBC; //0xB0 or 176

void setup() {
usb.init(midi);
// MIDI.begin();
//Serial.begin(31250);
}                         
void loop() {
  for(unsigned char i=0; i<numPots; i++) {
    currentPot[i] = analogRead(i) / 8;   
    if(abs(currentPot[i]-pot[i]) > b) {
      sendMidi(controlChange, i+1, currentPot[i]);
      pot[i] = currentPot[i];
    }
  }
}

void sendMidi(byte controlChange, unsigned int controlNum, int val) {
//MIDI.sendControlChange(controlNum, val);

Serial.write(controlChange);
Serial.write(controlNum);
Serial.write(val);
  // Serial.write(unsigned char(controlChange));
  //   Serial.write(unsigned char(controlNum));
  //     Serial.write(unsigned char(val));
  }
 
 
 
 





Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy