How hard can this be!!! MIDI CC to Hardware

Status
Not open for further replies.

xox07

New member
I want to send midi cc parameter control data to control hardware parameters. All I need to do is asign specific midi cc numbers and values to pots or map cc to pots that will allow me to control hardware using a midi cable

There are plenty of amazing people in this community please point me (code wise) in the right direction because I have looked everywhere for a month but all I can find is people making controllers for software?

Am I really that old?

Anyway I can make functional software midi controllers all day long but for the life of me I can not communicate with hardware.

Please!!calling all teensy and Avr geniuses help me before I go completely bald. If not for me for the kids haha!
 
I apologize here is the schematic and solidworks mock up DW8K CONTROLLER.jpgPROGRAM CONTROLLER.jpg
 

Pete I tried the loop but i don't believe my variables are correct?

#include <MIDI.h>


// Variables:
int cc = 1;
int AnalogValue[2] = {0,0}; // define variables for the controller data
int lastAnalogValue[2] = {0,0}; // define the "lastValue" variables

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

}

void loop() {

AnalogValue0 = analogRead(0); //knob 1 cutoff
// convert to a range from 0 to 127:
cc = AnalogValue0 / 8;
// check if analog input has changed
if (abs(lastAnalogValue0 - cc) > 1) {
MIDI.sendControlChange(21, cc, 1);
// update lastAnalogValue zero variable
lastAnalogValue0 = cc;
}
AnalogValue1 = analogRead(1); //knob 2 resonance
// convert to a range from 0 to 63:
cc = AnalogValue1 / 8;
// check if analog input has changed
if (abs(lastAnalogValue1 - cc) > 1) {
MIDI.sendControlChange(22, cc, 1);
// update lastAnalogValue one variable
lastAnalogValue1 = cc;
}

}
 
I think you're just missing some square brackets and, if you need a value from 0 to 63, divide by 16 instead of 8.
Code:
#include <MIDI.h>


// Variables:
int cc = 1;
int AnalogValue[2] = {0,0}; // define variables for the controller data
int lastAnalogValue[2] = {0,0}; // define the "lastValue" variables

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

}

void loop() {

AnalogValue[0] = analogRead(0); //knob 1 cutoff
// convert to a range from 0 to 127:
cc = AnalogValue[0] / 8;
// check if analog input has changed
if (abs(lastAnalogValue[0] - cc) > 1) {
MIDI.sendControlChange(21, cc, 1);
// update lastAnalogValue zero variable
lastAnalogValue[0] = cc;
}
AnalogValue[1] = analogRead(1); //knob 2 resonance
// convert to a range from 0 to 63:
cc = AnalogValue[1] / 16;
// check if analog input has changed
if (abs(lastAnalogValue[1] - cc) > 1) {
MIDI.sendControlChange(22, cc, 1);
// update lastAnalogValue one variable
lastAnalogValue[1] = cc;
}

}
 
Last edited:
This is a perfect time to start using the Arduino Serial Monitor.

For example:

Code:
  AnalogValue[0] = analogRead(0); //knob 1 cutoff
  // convert to a range from 0 to 127:
  cc = AnalogValue[0] / 8;
  Serial.print("cc = ");
  Serial.println(cc);

or like this:

Code:
  // check if analog input has changed
  if (abs(lastAnalogValue[0] - cc) > 1) {
    MIDI.sendControlChange(21, cc, 1);
    Serial.print("sending cc21 = ");
    Serial.println(cc);

By simply adding these, you can observe with the Arduino Serial Monitor what your program is really computing and transmitting (and whether it's actually transmitting).
 
Did you get it to work, xox07? Just curious, how are you planning to build that case/panel? I'm also working on a MIDI controller but haven't found any good solution for the panel printing and drilling. Do you know any good online services for designing/ordering panels and cases?
 
Status
Not open for further replies.
Back
Top