frankestrada41
New member
I just bought a Teensy 2.0 and my problem is that I followed the instructions of "How to make a MIDI Controller" from DJ Tech Tools and the firsts days worked but then an issue showed up. The CC values oscillated like crazy when trying to map the controller (on Ableton Live).
The code compiles correctly and the electronics work.
Does that mean my Teensy is broken?
Here shows the electronics ;
https://djtechtools.com/2015/08/25/how-to-make-your-own-diy-midi-controller/
and the code;
#include <Bounce.h>
// define how many pots are active up to number of available analog inputs
#define analogInputs 8
// make arrays for input values and lagged input values
int inputAnalog[analogInputs];
int iAlag[analogInputs];
// make array of cc values
int ccValue[analogInputs];
// index variable for loop
int i;
void setup() {
// MIDI rate
Serial.begin(31250);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
}
void loop() {
// loop trough active inputs for knobs
for (i=0;i<analogInputs;i++){
// read current value at i-th input
inputAnalog = analogRead(i);
// if magnitude of difference is 8 or more...
if (abs(inputAnalog - iAlag) > 7){
// calc the CC value based on the raw value
ccValue = inputAnalog/8;
// send the MIDI
usbMIDI.sendControlChange(i, ccValue, 3);
// set raw reading to lagged array for next comparison
iAlag = inputAnalog;
}
delay(5); // limits MIDI messages to reasonable number
}
}
The code compiles correctly and the electronics work.
Does that mean my Teensy is broken?
Here shows the electronics ;
https://djtechtools.com/2015/08/25/how-to-make-your-own-diy-midi-controller/
and the code;
#include <Bounce.h>
// define how many pots are active up to number of available analog inputs
#define analogInputs 8
// make arrays for input values and lagged input values
int inputAnalog[analogInputs];
int iAlag[analogInputs];
// make array of cc values
int ccValue[analogInputs];
// index variable for loop
int i;
void setup() {
// MIDI rate
Serial.begin(31250);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
}
void loop() {
// loop trough active inputs for knobs
for (i=0;i<analogInputs;i++){
// read current value at i-th input
inputAnalog = analogRead(i);
// if magnitude of difference is 8 or more...
if (abs(inputAnalog - iAlag) > 7){
// calc the CC value based on the raw value
ccValue = inputAnalog/8;
// send the MIDI
usbMIDI.sendControlChange(i, ccValue, 3);
// set raw reading to lagged array for next comparison
iAlag = inputAnalog;
}
delay(5); // limits MIDI messages to reasonable number
}
}