Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: 3.2 Midi controller help

  1. #1
    Junior Member
    Join Date
    Dec 2016
    Posts
    2

    3.2 Midi controller help

    Hello all,

    I started a project and I may have bitten off more than I can chew. I am new to al of this and I need some help.

    my project is to make a arcade button midi controller, I have all of the button wired to each other and then to the ground and I have buttons 1-16 using slots 0-15 on the 3.2 board.

    I have done the programming for the buttons and I get feed back from buttons 1-11 but not the buttons wired into slots 12-15.

    to my understanding these slots should be good for buttons..but its not working..can anyone give me a hand on this one, or tell me a place to start looking

    thank you

    Click image for larger version. 

Name:	IMG_20161229_191957939.jpg 
Views:	72 
Size:	70.2 KB 
ID:	9250Click image for larger version. 

Name:	IMG_20161229_191930673.jpg 
Views:	69 
Size:	76.6 KB 
ID:	9251Click image for larger version. 

Name:	IMG_20161229_191953686.jpg 
Views:	63 
Size:	172.4 KB 
ID:	9252

  2. #2
    Please post accompanying code for the project.

  3. #3
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,079
    Note, you probably don't want to use pin 13 for reading a button. Pin 13 has the LED on it and a resistor for the LED. This can interfere with using the pin for digital input unless you factor in the pin having a resistor.

  4. #4
    Junior Member
    Join Date
    Dec 2016
    Posts
    2
    sure thing

    I made edits to this one...most of the buttons work except the top 4.

    I change out pin 13, right now I have no LED's on the board

    /* Buttons to USB MIDI Example

    You must select MIDI from the "Tools > USB Type" menu

    To view the raw MIDI data on Linux: aseqdump -p "Teensy MIDI"

    This example code is in the public domain.
    */

    #include <Bounce.h>

    // the MIDI channel number to send messages
    const int channel = 1;

    // Create Bounce objects for each button. The Bounce object
    // automatically deals with contact chatter or "bounce", and
    // it makes detecting changes very simple.
    Bounce button0 = Bounce(0, 5);
    Bounce button1 = Bounce(1, 5); // 5 = 5 ms debounce time
    Bounce button2 = Bounce(2, 5); // which is appropriate for good
    Bounce button3 = Bounce(3, 5); // quality mechanical pushbuttons
    Bounce button4 = Bounce(4, 5);
    Bounce button5 = Bounce(5, 5); // if a button is too "sensitive"
    Bounce button6 = Bounce(6, 5); // to rapid touch, you can
    Bounce button7 = Bounce(7, 5); // increase this time.
    Bounce button8 = Bounce(8, 5);
    Bounce button9 = Bounce(9, 5);
    Bounce button10 = Bounce(10, 5);
    Bounce button11 = Bounce(11, 5);
    Bounce button12 = Bounce(12, 5);
    Bounce button13 = Bounce(13, 5);
    Bounce button14 = Bounce(14, 5);
    Bounce button15 = Bounce(15, 5);


    void setup() {
    // Configure the pins for input mode with pullup resistors.
    // The pushbuttons connect from each pin to ground. When
    // the button is pressed, the pin reads LOW because the button
    // shorts it to ground. When released, the pin reads HIGH
    // because the pullup resistor connects to +5 volts inside
    // the chip. LOW for "on", and HIGH for "off" may seem
    // backwards, but using the on-chip pullup resistors is very
    // convenient. The scheme is called "active low", and it's
    // very commonly used in electronics... so much that the chip
    // has built-in pullup resistors!
    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); // Teensy++ 2.0 LED, may need 1k resistor
    pullup
    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);// Teensy 2.0 LED, may need 1k resistor pullup
    }

    void loop() {
    // Update all the buttons. There should not be any long
    // delays in loop(), so this runs repetitively at a rate
    // faster than the buttons could be pressed and released.
    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();

    // Check each button for "falling" edge.
    // Send a MIDI Note On message when each button presses
    // Update the Joystick buttons only upon changes.
    // falling = high (not pressed - voltage from pullup resistor)
    // to low (pressed - button connects pin to ground)
    if (button0.fallingEdge()) {
    usbMIDI.sendNoteOn(60, 99, channel); // 60 = C4
    }
    if (button1.fallingEdge()) {
    usbMIDI.sendNoteOn(61, 99, channel); // 61 = C#4
    }
    if (button2.fallingEdge()) {
    usbMIDI.sendNoteOn(62, 99, channel); // 62 = D4
    }
    if (button3.fallingEdge()) {
    usbMIDI.sendNoteOn(63, 99, channel); // 63 = D#4
    }
    if (button4.fallingEdge()) {
    usbMIDI.sendNoteOn(64, 99, channel); // 64 = G#3
    }
    if (button5.fallingEdge()) {
    usbMIDI.sendNoteOn(65, 99, channel); // 65 = A3
    }
    if (button6.fallingEdge()) {
    usbMIDI.sendNoteOn(66, 99, channel); // 66 = A#3
    }
    if (button7.fallingEdge()) {
    usbMIDI.sendNoteOn(67, 99, channel); // 67 = B3
    }
    if (button8.fallingEdge()) {
    usbMIDI.sendNoteOn(68, 99, channel); // 68 = E3
    }
    if (button9.fallingEdge()) {
    usbMIDI.sendNoteOn(69, 99, channel); // 69 = F3
    }
    if (button10.fallingEdge()) {
    usbMIDI.sendNoteOn(70, 99, channel); // 70 = F#3
    }
    if (button11.fallingEdge()) {
    usbMIDI.sendNoteOn(71, 99, channel); // 71 = G3
    }
    if (button12.fallingEdge()) {
    usbMIDI.sendNoteOn(71, 99, channel); // 72 = C3
    }
    if (button13.fallingEdge()) {
    usbMIDI.sendNoteOn(71, 99, channel); // 73 = C#3
    }
    if (button14.fallingEdge()) {
    usbMIDI.sendNoteOn(71, 99, channel); // 74 = D3
    }
    if (button15.fallingEdge()) {
    usbMIDI.sendNoteOn(71, 99, channel); // 75 = D#3
    }



    // Check each button for "rising" edge
    // Send a MIDI Note Off message when each button releases
    // For many types of projects, you only care when the button
    // is pressed and the release isn't needed.
    // rising = low (pressed - button connects pin to ground)
    // to high (not pressed - voltage from pullup resistor)
    if (button0.risingEdge()) {
    usbMIDI.sendNoteOff(60, 0, channel); // 60 = C4
    }
    if (button1.risingEdge()) {
    usbMIDI.sendNoteOff(61, 0, channel); // 61 = C#4
    }
    if (button2.risingEdge()) {
    usbMIDI.sendNoteOff(62, 0, channel); // 62 = D4
    }
    if (button3.risingEdge()) {
    usbMIDI.sendNoteOff(63, 0, channel); // 63 = D#4
    }
    if (button4.risingEdge()) {
    usbMIDI.sendNoteOff(64, 0, channel); // 64 = G#3
    }
    if (button5.risingEdge()) {
    usbMIDI.sendNoteOff(65, 0, channel); // 65 = A3
    }
    if (button6.risingEdge()) {
    usbMIDI.sendNoteOff(66, 0, channel); // 66 = A#3
    }
    if (button7.risingEdge()) {
    usbMIDI.sendNoteOff(67, 0, channel); // 67 = B3
    }
    if (button8.risingEdge()) {
    usbMIDI.sendNoteOff(68, 0, channel); // 68 = E3
    }
    if (button9.risingEdge()) {
    usbMIDI.sendNoteOff(69, 0, channel); // 69 = F3
    }
    if (button10.risingEdge()) {
    usbMIDI.sendNoteOff(70, 0, channel); // 70 = F#3
    }
    if (button11.risingEdge()) {
    usbMIDI.sendNoteOff(71, 0, channel); // 71 = G3
    }
    if (button12.risingEdge()) {
    usbMIDI.sendNoteOff(71, 0, channel); // 72 = C3
    }
    if (button13.risingEdge()) {
    usbMIDI.sendNoteOff(71, 0, channel); // 73 = C#3
    }
    if (button14.risingEdge()) {
    usbMIDI.sendNoteOff(71, 0, channel); // 74 = D3
    }
    if (button15.risingEdge()) {
    usbMIDI.sendNoteOff(71, 0, channel); // 75 = D#3
    }
    // MIDI Controllers should discard incoming MIDI messages.
    //
    http://forum.pjrc.com/threads/24179-...ses-midi-crash
    while (usbMIDI.read()) {
    // ignore incoming messages
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •