Library for super EASY Teensy MIDI programming
Library for super EASY Teensy MIDI programming Posted on: 08.03.2013 by Brendan Andrascik Do you want to build your dream controller but don't have the know-how or just can't be bothered going through that complex process of programming? Not a problem at all, I have developed a library for Teensy that wraps up and hides the ugly process of reading pins and deciding whether to send MIDI signals or not, into couple of easy to use Classes. Just create an instance for each component of your controller, like Button, Potentiometer, LED etc and just with couple lines of code never bother again about the logic behind it.Here is a simple example for a fully functioning one button and fader controller: Code:
boolean debug=false; // print to serial instead of midi boolean secondary=true; // enable secondary midi messages int midiChannel=1; // midi channel number // declare all your components here Button but(17,midiChannel,1,secondary,debug); // button 1 on pin 17 Potentiometer pot(45,midiChannel,3,secondary,debug); // knob on pin 45 (A7) void setup(){ } void loop(){ // add here all the input component reads pot.read(); // read knob and send midi messages but.read(); // read buttons and send midi messages } Doc: http://tomashg.com/?p=854 | |
Weldon Dilg 11.03.2013 |
Originally Posted by ghztomash
im trying to get 2 pot outputs and 2 button outputs from a gameport joystick. |
Brendan Andrascik 09.03.2013 |
Originally Posted by mdcdesign
Probably I will add a multiplexer class at some point |
Doreen Schurle 08.03.2013 |
Originally Posted by ghztomash
|
Brendan Andrascik 08.03.2013 | Do you want to build your dream controller but don't have the know-how or just can't be bothered going through that complex process of programming? Not a problem at all, I have developed a library for Teensy that wraps up and hides the ugly process of reading pins and deciding whether to send MIDI signals or not, into couple of easy to use Classes. Just create an instance for each component of your controller, like Button, Potentiometer, LED etc and just with couple lines of code never bother again about the logic behind it. Here is a simple example for a fully functioning one button and fader controller: Code:
boolean debug=false; // print to serial instead of midi boolean secondary=true; // enable secondary midi messages int midiChannel=1; // midi channel number // declare all your components here Button but(17,midiChannel,1,secondary,debug); // button 1 on pin 17 Potentiometer pot(45,midiChannel,3,secondary,debug); // knob on pin 45 (A7) void setup(){ } void loop(){ // add here all the input component reads pot.read(); // read knob and send midi messages but.read(); // read buttons and send midi messages } Doc: http://tomashg.com/?p=854 |
Brendan Andrascik 12.03.2013 | Hey, if you open up the examples included with the library there is one empty template you could fill in and a complete working example with comments. Head over to http://tomashg.com/?p=854 for the complete list of functions, classes and their description. if you want to read 2 pots and 2 buttons from your teensy, then create two objects of each class, for example Potentiometer pot1(the pin number the pot is connected on your teensy, midi channel you want it to send the message on, the control change number you want it to use); same for pot2, and the buttons but with different pin number and cc number, then inside void loop call the read function for every instance, pot1.read(); pot2.read(); button1.read(); button2.read(); and that's it! also note that you have to set the USB Type to MIDI in the Arduino IDE or else the library will not compile. |
Weldon Dilg 11.03.2013 |
Originally Posted by ghztomash
im trying to get 2 pot outputs and 2 button outputs from a gameport joystick. |
Brendan Andrascik 09.03.2013 |
Originally Posted by mdcdesign
Probably I will add a multiplexer class at some point |
Doreen Schurle 08.03.2013 |
Originally Posted by ghztomash
|
<< Back to Reviews of DJ equipment Reply