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

Thread: Buttons, Switch, and TS inputs not working with Teensy 3.6

  1. #1
    Junior Member
    Join Date
    Jan 2019
    Posts
    9

    Buttons, Switch, and TS inputs not working with Teensy 3.6

    Alright, simple buttons, a switch, and a TS input. At one point in my testing they worked just fine with the breadboard and the Teensy 2.0. One wire going to Digital Inputs (0,1,2,3), one to ground. The switch works when I test it again. The buttons and TS input however do not work correctly. They will send a signal through the Serial Monitor when I touch and "untouch" the alligator clip to the solder lugs. But when I connect the clip and press the button it doesn't send that signal like it should. I've included the code that I am using for them. Like I said the switch works but the buttons or sustain pedal don't. Any ideas on if it could be my physical buttons having a problem or if it is something in my code which is essentially the same for each?

    Code:
    #include <Bounce.h>
    
    // Create Bounce objects for each button. The Bounce object
    // automatically deals with contact chatter or "bounce", and
    // it makes detecting changes very simple.
    // (#, ##) ## = debounce time
    Bounce button0 = Bounce(0, 10); // panic button
    Bounce button1 = Bounce(1, 10); // switch for snares
    Bounce button2 = Bounce(2, 10); // next patch button
    Bounce button3 = Bounce(3, 10); // sustain pedal
    
    // the MIDI channel number to send messages
    const int channel = 1;
    
    /////////////////////
    ////// SET UP ///////
    /////////////////////
    
    void setup() {
    Serial.begin(9600);
    pinMode(0, INPUT_PULLUP);
    pinMode(1, INPUT_PULLUP);
    pinMode(2, INPUT_PULLUP);
    pinMode(3, INPUT_PULLUP);
    }
    
    ////// LOOP /////
    void loop() {
    
    ///// BUTTONS /////
    button0.update();
    button1.update();
    button2.update();
    button3.update();
    
    /// ON ///
    if (button0.fallingEdge()) {
    usbMIDI.sendNoteOn(0, 127, channel);
    Serial.println("Panic!!!");
    }
    if (button1.fallingEdge()) {
    usbMIDI.sendNoteOn(1, 127, channel);
    Serial.println("Switch!!!");
    }
    if (button2.fallingEdge()) {
    usbMIDI.sendNoteOn(2, 127, channel);
    Serial.println("Next!!!");
    }
    if (button3.fallingEdge()) {
    usbMIDI.sendControlChange(64, 127, channel);
    Serial.println("Sustain!!!");
    }
    
    /// OFF ///
    if (button0.risingEdge()) {
    usbMIDI.sendNoteOff(0, 0, channel);
    Serial.println("Panic Off!!!");
    }
    if (button1.risingEdge()) {
    usbMIDI.sendNoteOff(1, 0, channel);
    Serial.println("Switch Off!!!");
    }
    if (button2.risingEdge()) {
    usbMIDI.sendNoteOff(2, 0, channel);
    Serial.println("Next Off!!!");
    }
    if (button3.risingEdge()) {
    usbMIDI.sendControlChange(64, 0, channel);
    Serial.println("Sustain Off!!!");
    }
    }
    Click image for larger version. 

Name:	51146908_10219319577439957_5969420357168267264_n.jpg 
Views:	8 
Size:	43.4 KB 
ID:	15885Click image for larger version. 

Name:	63B5A220-EE56-4671-B12A-7414970D9773.jpg 
Views:	7 
Size:	58.3 KB 
ID:	15886Click image for larger version. 

Name:	IMG_4388.jpg 
Views:	12 
Size:	142.7 KB 
ID:	15887Click image for larger version. 

Name:	IMG_4390.jpg 
Views:	13 
Size:	112.0 KB 
ID:	15888

  2. #2
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,043
    There doesn't appear to be any solder in the ground pin on the T3.6 (to the left of the black wire) and the ground side of the two red buttons are both gray wires that disappear somewhere. Have you connected the grounds to the T3.6 somewhere?
    A circuit diagram might help.

    Pete

  3. #3
    Junior Member
    Join Date
    Jan 2019
    Posts
    9
    All of the gray wires in the pictures are the many ground wires for the project. They all go together in the 2nd picture and come out with 1 wire. They are connected next to the black wire. I think the picture just doesn't show very well. I can try to fritz together a circuit diagram.

    Click image for larger version. 

Name:	IMG_4408.jpg 
Views:	9 
Size:	106.2 KB 
ID:	15889

  4. #4
    Junior Member
    Join Date
    Jan 2019
    Posts
    9
    Fritzing doesn't have a 3.6, but this is the basic wiring. First time trying this out. Hope it works and helps.

    L ---> R
    TRS Input, T 3.6, TS Input, Rocker Switch, 2 buttons

    Click image for larger version. 

Name:	Screen Shot 2019-02-11 at 7.00.19 PM.png 
Views:	4 
Size:	120.9 KB 
ID:	15890

  5. #5
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,043
    Let's focus on one button for now - the one with the black wire that goes to digital pin 0.
    Run the sketch in message #1.
    Connect a short piece of wire directly from the ground side of the button to the T3.6 ground pin and push the button.
    The program should print Panic!!!
    If it does, the problem is most likely in the connection from the button's ground to where all the grounds meet.
    If it doesn't, then either the button is dead or the connection at either end of the black wire is bad.

    Do you have a multimeter?

    Pete

  6. #6
    Junior Member
    Join Date
    Jan 2019
    Posts
    9
    AYYY!!! We've got lift-off. Just need to redo those grounds in the mass connect. haha. Both buttons, switch, and TS input worked bypassing the mass connect ground. Thank you for that idea. Not sure WHY ON EARTH I didn't think of it. haha. Thank you!

    I do have a multimeter.

  7. #7
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,043
    You're welcome. I'm glad it was an easy fix

    Pete

  8. #8
    Junior Member
    Join Date
    Jan 2019
    Posts
    9
    Got done redoing the ground connections for those and chose to set those apart from the rest of the grounds coming in so I now have 2 ground wires going to the Teensy. Tested it again and all of them worked.

Posting Permissions

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