Saturday, September 03, 2011

MIDI with Teensy: Light Controlled Pitch Bends




Hardware
:



Software:
int current_analog;

int previous_analog;

int current_button;
int previous_button;

void setup() {
pinMode(0, INPUT);
digitalWrite(0, HIGH);
pinMode(11, OUTPUT);
}

void loop() {
current_analog = analogRead(0);
if(current_analog != previous_analog) {
usbMIDI.sendPitchBend(current_analog << 4, 1);
previous_analog = current_analog;
delay(1);
}


current_button = digitalRead(0);
if(current_button != previous_button) {
usbMIDI.sendNoteOn(60, 127 * (! current_button), 1);
delay(5);
previous_button = current_button;
}
}

3 comments:

Anonymous said...

Nice! Will be implementing this on my
MPC. Thanks!

Anonymous said...

Can you please provide pins to be used with Teensy ++ ?

If I am using Analog Pin 28 instead of 0 is it correct ?

Anonymous said...

Hello, i begin with my teensy, and i create a two button controller (when raisingEdge send a noteOn, when raisingFall send a noteOff). But i got some problem to do it recognize by Ableton. Vdmx detect them without difficulty.
Do you have some advice ?
Regards Gilles