Pages: [1]   Go Down
Author Topic: simple 6 pot arduino midi-over-USB-controller problem  (Read 1113 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
//#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));
  }
 
 
 
 



Logged

Pages: [1]   Go Up
Jump to: