rarelynecessary
New member
So I'm picking back up a project I mostly finished but abandoned a few years ago making a midi controller with a teensy 3.5. When I was doing this the first time round (I lost the wip code so I've had to start over on that front), I had soldered one of my buttons onto pin 13, which is also the pin for the built-in LED. I'm not sure how to draw a schematic quickly, but this button basically goes GND -- Button -- Pin 13.
Cut to now, That pin in particular is giving me some trouble, which I think is related to the LED, but I could be wrong. In my larger code, I'm using Bounce2 to debounce, and it works totally as expected for everything except this one pin, which it reads as always being pressed down. Does this sound like it's being caused by the internal LED, and if so, is there anything I can do to stabilize this button without ripping out the soldering I've already one? Or is this probably being caused by something else? Any advice helps!
I've tried to make a shorter program to debug, here are the two I've used:
This prints out "Button pushed" as soon as it loads and doesn't stop no matter what I do
This is more like what I actually have in my code. This will print "Button down" when I push the button, and "Button up" when I push another button (usually--it's sporadic whether or not that actually works), but not when I let go of the button on pin 13. It also starts out in a pressed state, so I have to hit another button before I can get it to show anything at all
Quick Edit: This also may be a hardware problem, I just assumed it was a pin problem since it just happened to be a problem on the internal LED pin. If this sounds like something more likely to be hardware, I can find a way to test that instead
Cut to now, That pin in particular is giving me some trouble, which I think is related to the LED, but I could be wrong. In my larger code, I'm using Bounce2 to debounce, and it works totally as expected for everything except this one pin, which it reads as always being pressed down. Does this sound like it's being caused by the internal LED, and if so, is there anything I can do to stabilize this button without ripping out the soldering I've already one? Or is this probably being caused by something else? Any advice helps!
I've tried to make a shorter program to debug, here are the two I've used:
This prints out "Button pushed" as soon as it loads and doesn't stop no matter what I do
Code:
void setup() {
Serial.begin(9600);
}
void loop () {
if ( digitalRead(13) == LOW ) {
Serial.println("Button pushed");
}
}
This is more like what I actually have in my code. This will print "Button down" when I push the button, and "Button up" when I push another button (usually--it's sporadic whether or not that actually works), but not when I let go of the button on pin 13. It also starts out in a pressed state, so I have to hit another button before I can get it to show anything at all
Code:
#include "Bounce2.h"
Bounce b = Bounce();
void setup() {
b.attach(13, INPUT_PULLUP);
b.interval(25);
Serial.begin(9600);
}
void loop () {
b.update();
if ( b.fell() ) {
Serial.println("Button down");
}
if ( b.rose() ) {
Serial.println("Button up");
}
}
Quick Edit: This also may be a hardware problem, I just assumed it was a pin problem since it just happened to be a problem on the internal LED pin. If this sounds like something more likely to be hardware, I can find a way to test that instead
Last edited: