I personally own a Mixman DM2 Dj gear thing and since there is no way for it to work on anything newer then XP. Instead of trashing it I decided I could mod it to work on any OS I choose. I took the main board out and throw it in my parts bin and turned to the Teensy 2.0 ++ as the new main board for it. I made a custom new board with the Teensy solder to it. I'm running into some snags with the coding since I don't really have a lot of pins on the Teensy I can work with so I'm working with a 74HC4051 chip to add more pins to the Teensy. I'm coding on a Windows 8. I need to get a 74HC4051 chip to work with the Teensy and I'm not sure if my code would work. It's written in Arduino programming language. Version of Arduino program is 1.6.7 with Teensyduino 1.27 installed.
Not in the picture are the 2 midi ports and the 2 add buttons.
So here is the the break down of what is attached to the Teensy:
---------------------------------------------------------------------------------
Going to add later on.
---------------------------------------------------------------------------------
here is the code I have so far.
Some of this code is pieced together since I don't know this coding language at all.
Not in the picture are the 2 midi ports and the 2 add buttons.
So here is the the break down of what is attached to the Teensy:
- 2 MIDI ports (1 for input and 1 out put)
- 33 butttons
- 2 encoders
- 1 linear slide potentiometer
- 16 Led's
- 3 74HC4051
---------------------------------------------------------------------------------
Going to add later on.
---------------------------------------------------------------------------------
- 16 ( More ) linear slide potentiometer
- 24 potentiometer
- 5 ( More ) 74HC4051
here is the code I have so far.
Code:
#include <Bounce.h>
//#define ENCODER_OPTIMIZE_INTERRUPTS
#include <Encoder.h>
//midi pass thru
#include <MIDI.h>
// define how many pots are active up to number of available analog inputs
#define analogInputs 8
//midi pass thru
int chnl,d1,d2,dd;
// make arrays for input values and lagged input values
int inputAnalog[analogInputs];
int iAlag[analogInputs];
// 74HC4051 chip
int chipselect = 0
// make array of cc values
int ccValue[analogInputs];
// index variable for loop
int i;
// cc values for buttons
int cc_off = 0;
int cc_on = 65;
int cc_super = 127;
// map buttons to cc for button
//(add more buttons here)
int cc0 = 51;
int cc1 = 52;
int cc2 = 53;
int cc3 = 54;
int cc4 = 55;
int cc5 = 56;
int cc6 = 57;
int cc7 = 58;
int cc8 = 59;
int cc9 = 60;
int cc10 = 61;
int cc11 = 62;
int cc12 = 63;
int cc13 = 64;
int cc14 = 65;
int cc15 = 66;
int cc16 = 67;
int cc17 = 68;
int cc18 = 69;
int cc19 = 70;
int cc20 = 71;
int cc21 = 72;
int cc22 = 73;
int cc23 = 74;
int cc24 = 75;
int cc25 = 76;
int cc26 = 77;
int cc27 = 78;
/* Encoder Library - TwoKnobs Example
* http://www.pjrc.com/teensy/td_libs_Encoder.html
*
* This example code is in the public domain.
*/
// Change these pin numbers to the pins connected to your encoder.
// Best Performance: both pins have interrupt capability
// Good Performance: only the first pin has interrupt capability
// Low Performance: neither pin has interrupt capability
Encoder knobLeft(0, 1);
Encoder knobRight(18, 19);
// avoid using pins with LEDs attached
//(add more buttons here)
//Bounce button0 = Bounce(4, 3);
//Bounce button1 = Bounce(5, 3);
//Bounce button2 = Bounce(7, 3);
Bounce button3 = Bounce(8, 3);
Bounce button4 = Bounce(9, 3);
Bounce button5 = Bounce(10, 3);
Bounce button6 = Bounce(11, 3);
Bounce button7 = Bounce(12, 3);
Bounce button8 = Bounce(13, 3);
Bounce button9 = Bounce(14, 3);
Bounce button10 = Bounce(15, 3);
Bounce button11 = Bounce(16, 3);
Bounce button12 = Bounce(17, 3);
Bounce button13 = Bounce(20, 3);
Bounce button14 = Bounce(21, 3);
Bounce button15 = Bounce(22, 3);
Bounce button16 = Bounce(23, 3);
Bounce button17 = Bounce(24, 3);
Bounce button18 = Bounce(25, 3);
Bounce button19 = Bounce(26, 3);
Bounce button20 = Bounce(28, 3);
Bounce button21 = Bounce(29, 3);
Bounce button22 = Bounce(30, 3);
Bounce button23 = Bounce(31, 3);
Bounce button24 = Bounce(32, 3);
Bounce button25 = Bounce(33, 3);
Bounce button26 = Bounce(34, 3);
Bounce button27 = Bounce(35, 3);
//midi pass thru
kMIDIType type;
void setup() {
// MIDI rate
//Serial.begin(31250);
//debug serial
Serial.begin(9600);
Serial.println("TwoKnobs Encoder Test:");
// pins for buttons, sliders, and pots
// 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); led pin
// pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
pinMode(13, INPUT_PULLUP);
pinMode(14, INPUT_PULLUP);
pinMode(15, INPUT_PULLUP);
pinMode(16, INPUT_PULLUP);
pinMode(17, INPUT_PULLUP);
pinMode(20, INPUT_PULLUP);
pinMode(21, INPUT_PULLUP);
pinMode(22, INPUT_PULLUP);
pinMode(23, INPUT_PULLUP);
pinMode(24, INPUT_PULLUP);
pinMode(25, INPUT_PULLUP);
pinMode(26, INPUT_PULLUP);
pinMode(27, INPUT_PULLUP); // the common pin from the 74HC4051
pinMode(28, INPUT_PULLUP);
pinMode(29, INPUT_PULLUP);
pinMode(30, INPUT_PULLUP);
pinMode(31, INPUT_PULLUP);
pinMode(32, INPUT_PULLUP);
pinMode(33, INPUT_PULLUP);
pinMode(34, INPUT_PULLUP);
pinMode(35, INPUT_PULLUP);
// Anaglog
pinMode(38, INPUT_PULLUP);
// pinMode(39, INPUT_PULLUP);
// pinMode(40, INPUT_PULLUP);
// pinMode(41, INPUT_PULLUP);
// pinMode(42, INPUT_PULLUP);
// pinMode(43, INPUT_PULLUP);
// pinMode(44, INPUT_PULLUP);
// pinMode(45, INPUT_PULLUP);
}
long positionLeft = -999;
long positionRight = -999;
void loop() {
// 74HC4051 chip
switch (chipselect) {
case 0:
// pinMode(4, OUTPUT);
// pinMode(5, OUTPUT);
// pinMode(7, OUTPUT);
chipselect = chipselect + 1
break;
case 1:
pinMode(4, OUTPUT);
// pinMode(5, OUTPUT);
// pinMode(7, OUTPUT);
chipselect = chipselect + 1
break;
case 2:
// pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
// pinMode(7, OUTPUT);
chipselect = chipselect + 1
break;
case 3:
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
// pinMode(7, OUTPUT);
chipselect = chipselect + 1
break;
case 4:
// pinMode(4, OUTPUT);
// pinMode(5, OUTPUT);
pinMode(7, OUTPUT);
chipselect = chipselect + 1
break;
case 5:
pinMode(4, OUTPUT);
// pinMode(5, OUTPUT);
pinMode(7, OUTPUT);
chipselect = chipselect + 1
break;
case 6:
// pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(7, OUTPUT);
chipselect = chipselect + 1
break;
case 7:
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(7, OUTPUT);
chipselect = chipselect + 1
break;
default:
chipselect = 0
break;
}
//midi pass thru
if (MIDI.read() && MIDI.getType() < SystemExclusive) {
type = MIDI.getType();
d1 = MIDI.getData1();
d2 = MIDI.getData2();
dd = d1 + (d2 << 8);
chnl = MIDI.getChannel();
// and then send...
switch(type){
case NoteOn:
usbMIDI.sendNoteOn(d1,d2,chnl);
break;
case NoteOff:
usbMIDI.sendNoteOff(d1,d2,chnl);
break;
case AfterTouchPoly:
usbMIDI.sendPolyPressure(d1,d2,chnl);
break;
case ControlChange:
usbMIDI.sendControlChange(d1,d2,chnl);
break;
case ProgramChange:
usbMIDI.sendProgramChange(dd,chnl);
break;
case AfterTouchChannel:
usbMIDI.sendAfterTouch(dd,chnl);
break;
case PitchBend:
usbMIDI.sendPitchBend(dd,chnl);
break;
case SystemExclusive:
// handle sysex
break;
default:
// F8 et seq.
break;
}
}
if (usbMIDI.read() && usbMIDI.getType() < SystemExclusive) {
type = (kMIDIType) usbMIDI.getType();
d1 = usbMIDI.getData1();
d2 = usbMIDI.getData2();
chnl = usbMIDI.getChannel();
// and then send...
MIDI.send(type,d1,d2,chnl);
}
//scratch wheel
long newLeft, newRight;
newLeft = knobLeft.read();
newRight = knobRight.read();
if (newLeft != positionLeft || newRight != positionRight) {
Serial.print("Left = ");
Serial.print(newLeft);
Serial.print(", Right = ");
Serial.print(newRight);
Serial.println();
positionLeft = newLeft;
positionRight = newRight;
}
// if a character is sent from the serial monitor,
// reset both back to zero.
if (Serial.available()) {
Serial.read();
Serial.println("Reset both knobs to zero");
knobLeft.write(0);
knobRight.write(0);
}
// loop trough active inputs for knobs
for (i=0;i<analogInputs;i++){
// read current value at i-th input
inputAnalog[i] = analogRead(i);
// if magnitude of difference is 8 or more...
if (abs(inputAnalog[i] - iAlag[i]) > 7){
// calc the CC value based on the raw value
ccValue[i] = inputAnalog[i]/8;
// send the MIDI
usbMIDI.sendControlChange(i, ccValue[i], 3);
// set raw reading to lagged array for next comparison
iAlag[i] = inputAnalog[i];
}
delay(5); // limits MIDI messages to reasonable number
}
// Push Button code
//(add more buttons here)
// button0.update();
// button1.update();
// button2.update();
button3.update();
button4.update();
button5.update();
button6.update();
button7.update();
button8.update();
button9.update();
button10.update();
button11.update();
button12.update();
button13.update();
button14.update();
button15.update();
button16.update();
button17.update();
button18.update();
button19.update();
button20.update();
button21.update();
button22.update();
button23.update();
button24.update();
button25.update();
button26.update();
button27.update();
//(add more buttons here)
// if (button0.fallingEdge())
// {
// usbMIDI.sendControlChange(cc0, cc_on, 3);
// }
// if (button1.fallingEdge())
// {
// usbMIDI.sendControlChange(cc1, cc_on, 3);
// }
// if (button2.fallingEdge())
// {
// usbMIDI.sendControlChange(cc2, cc_on, 3);
// }
if (button3.fallingEdge())
{
usbMIDI.sendControlChange(cc3, cc_on, 3);
}
if (button4.fallingEdge())
{
usbMIDI.sendControlChange(cc4, cc_on, 3);
}
if (button5.fallingEdge())
{
usbMIDI.sendControlChange(cc5, cc_on, 3);
}
if (button6.fallingEdge())
{
usbMIDI.sendControlChange(cc6, cc_on, 3);
}
if (button7.fallingEdge())
{
usbMIDI.sendControlChange(cc7, cc_on, 3);
}
if (button8.fallingEdge())
{
usbMIDI.sendControlChange(cc8, cc_on, 3);
}
if (button9.fallingEdge())
{
usbMIDI.sendControlChange(cc9, cc_on, 3);
}
if (button10.fallingEdge())
{
usbMIDI.sendControlChange(cc10, cc_on, 3);
}
if (button11.fallingEdge())
{
usbMIDI.sendControlChange(cc11, cc_on, 3);
}
if (button12.fallingEdge())
{
usbMIDI.sendControlChange(cc12, cc_on, 3);
}
if (button13.fallingEdge())
{
usbMIDI.sendControlChange(cc13, cc_on, 3);
}
if (button14.fallingEdge())
{
usbMIDI.sendControlChange(cc14, cc_on, 3);
}
if (button15.fallingEdge())
{
usbMIDI.sendControlChange(cc15, cc_on, 3);
}
if (button16.fallingEdge())
{
usbMIDI.sendControlChange(cc16, cc_on, 3);
}
if (button17.fallingEdge())
{
usbMIDI.sendControlChange(cc17, cc_on, 3);
}
if (button18.fallingEdge())
{
usbMIDI.sendControlChange(cc18, cc_on, 3);
}
if (button19.fallingEdge())
{
usbMIDI.sendControlChange(cc19, cc_on, 3);
}
if (button20.fallingEdge())
{
usbMIDI.sendControlChange(cc20, cc_on, 3);
}
if (button21.fallingEdge())
{
usbMIDI.sendControlChange(cc21, cc_on, 3);
}
if (button22.fallingEdge())
{
usbMIDI.sendControlChange(cc22, cc_on, 3);
}
if (button23.fallingEdge())
{
usbMIDI.sendControlChange(cc23, cc_on, 3);
}
if (button24.fallingEdge())
{
usbMIDI.sendControlChange(cc24, cc_on, 3);
}
if (button25.fallingEdge())
{
usbMIDI.sendControlChange(cc25, cc_on, 3);
}
if (button26.fallingEdge())
{
usbMIDI.sendControlChange(cc26, cc_on, 3);
}
if (button27.fallingEdge())
{
usbMIDI.sendControlChange(cc27, cc_on, 3);
}
//(add more buttons here)
// if (button0.risingEdge())
// {
// usbMIDI.sendControlChange(cc0, cc_off, 3);
// }
// if (button1.risingEdge())
// {
// usbMIDI.sendControlChange(cc1, cc_off, 3);
// }
// if (button2.risingEdge())
// {
// usbMIDI.sendControlChange(cc2, cc_off, 3);
// }
if (button3.risingEdge())
{
usbMIDI.sendControlChange(cc3, cc_off, 3);
}
if (button4.risingEdge())
{
usbMIDI.sendControlChange(cc4, cc_off, 3);
}
if (button5.risingEdge())
{
usbMIDI.sendControlChange(cc5, cc_off, 3);
}
if (button6.risingEdge())
{
usbMIDI.sendControlChange(cc6, cc_off, 3);
}
if (button7.risingEdge())
{
usbMIDI.sendControlChange(cc7, cc_off, 3);
}
if (button8.risingEdge())
{
usbMIDI.sendControlChange(cc8, cc_off, 3);
}
if (button9.risingEdge())
{
usbMIDI.sendControlChange(cc9, cc_off, 3);
}
if (button10.risingEdge())
{
usbMIDI.sendControlChange(cc10, cc_off, 3);
}
if (button11.risingEdge())
{
usbMIDI.sendControlChange(cc11, cc_off, 3);
}
if (button12.risingEdge())
{
usbMIDI.sendControlChange(cc12, cc_off, 3);
}
if (button13.risingEdge())
{
usbMIDI.sendControlChange(cc13, cc_off, 3);
}
if (button14.risingEdge())
{
usbMIDI.sendControlChange(cc14, cc_off, 3);
}
if (button15.risingEdge())
{
usbMIDI.sendControlChange(cc15, cc_off, 3);
}
if (button16.risingEdge())
{
usbMIDI.sendControlChange(cc16, cc_off, 3);
}
if (button17.risingEdge())
{
usbMIDI.sendControlChange(cc17, cc_off, 3);
}
if (button18.risingEdge())
{
usbMIDI.sendControlChange(cc18, cc_off, 3);
}
if (button19.risingEdge())
{
usbMIDI.sendControlChange(cc19, cc_off, 3);
}
if (button20.risingEdge())
{
usbMIDI.sendControlChange(cc20, cc_off, 3);
}
if (button21.risingEdge())
{
usbMIDI.sendControlChange(cc21, cc_off, 3);
}
if (button22.risingEdge())
{
usbMIDI.sendControlChange(cc22, cc_off, 3);
}
if (button23.risingEdge())
{
usbMIDI.sendControlChange(cc23, cc_off, 3);
}
if (button24.risingEdge())
{
usbMIDI.sendControlChange(cc24, cc_off, 3);
}
if (button25.risingEdge())
{
usbMIDI.sendControlChange(cc25, cc_off, 3);
}
if (button26.risingEdge())
{
usbMIDI.sendControlChange(cc26, cc_off, 3);
}
if (button27.risingEdge())
{
usbMIDI.sendControlChange(cc27, cc_off, 3);
}
}
Some of this code is pieced together since I don't know this coding language at all.
Last edited: