Mapping Teensy with usbMidi in Traktor/Ableton

Status
Not open for further replies.

goldse26

New member
Hi all, I'm new here.

I came over from Arduino because of it's better options for sending MIDI signals.

I just set up a simple pushbutton on my teensy ++ to send a midi note when HIGH. This actually
works perfectly well and in MIDI-OX I receive the notes and all, but when it
comes to mapping my button in software (I have Traktor Pro and Ableton Live),
I get no response whatsoever. In both programs, it seems as if the MIDI isn't
coming through (It doesn't "learn"). Yet, at the same time, I can see the note coming in in MIDI-OX.
I've set the teensy as my input port, and "None" as my output port.

I've switched the button for a potentiometer - same result.
Unfortunately, I can't change computers.

Below is my code, could anything be interfering?
Am I using the right MIDI command?

Code:
const int b = 7;
const int led = 6;

void setup() {
  pinMode(b,INPUT);
  pinMode(led,OUTPUT);
}

void loop() {
   
  if (digitalRead(b) == HIGH)
  {
    
    digitalWrite(led,HIGH);
    usbMIDI.sendNoteOn(26,100,1); //note, velocity, channel
    delay(150); //delay so that only one signal goes through
    
  } else {
    digitalWrite(led,LOW);
  }
  
}
 
Having switched the note on, you are not switching it off again!

Code:
else {
    usbMIDI.sendNoteOn(26,0,1); //velocity zero means off
    digitalWrite(led,LOW);
  }
 
Try the example, from File > Examples > Teensy > USB_MIDI > Buttons.

I highly recommend you use the Bounce library to read pushbuttons (as shown in that example), rather than digitalRead().
 
Status
Not open for further replies.
Back
Top