tonberryhunter
Member
Hi Im using a Teensy 3.2 as a USB game controller but for some reason PIN 13 seems to not work correctly. Is this because of the LED function? Is there a way around this?
Is this because of the LED function?
Is there a way around this?
Yes. Or probably yes, given that we can't see your wiring or your code, but this is a common problem when pushbuttons are used in the ordinary way.
Connect the pushbutton between 3.3V and pin 13, and a resistor from pin 13 to GND. Or try pinMode INPUT_PULLDOWN instead of a real resistor.
Or use another pin.
The issue is that since pin 13 has a LED attached to it, the LED includes a resistor, and that changes the electrical characteristics of the line when trying to read from it. Hence Paul's suggestions of ways to work around that resistor. IIRC, using INPUT_PULLDOWN (or the resistor) will also flip the result of digitalRead.All other switches are wired identically and working with the Arduino code setting pinMode to input_pullup.
I did notice that when I grounded pin 13 to myself the switch seemed to work although the LED would go on and off. Not that I care if the led goes on and off but I wasnt sure if that would cause any issues elsewhere.