Can pushbuttons be connected directly to digital pins of the Teensy 3.1 without resistors? I am connecting a DJ Shield (http://www.makershed.com/products/dj-shield-kit) with its pushbuttons wired so they ground pins D2-D6 when pushed. The documentation implies that this is kosher, mentioning that pins can be configured with pullup resistors. I’m just curious why the circuit diagrams I find when searching for arduino button show a discrete resistor in the circuit diagram when it seems like it would be easier to do without the resistor.
just the reverse logic is sometimes odd (for normal brains)
Yes, all Teensy 3.1 digital pins support pinMode(pin, INPUT_PULLUP). So do all the digital pins on normal Arduino boards. Technically, the pullup resistors aren’t needed.
But consider the shield designer’s point of view. If the user types INPUT instead of INPUT_PULLUP (or just uses digitalRead without pinMode on AVR), their shield product appears to be defective when tested with a voltmeter. Likewise, it can’t be tested alone without the Arduino, or when the Arduino is running some other sketch. From a commercial product point of view, if even a small fraction of users believe the product hardware is defective, when in fact the trouble is incorrect software on their part, it becomes an expensive problem. Except for board space, resistors cost almost nothing, so adding them to the design is cheap insurance and greatly improves the customer experience for novices who may not understand INPUT_PULLUP mode.
Good to know I don’t have to worry about adding resistors between the shield and the teensy 3.1. Great explanations.
Don’t forget about debounce when dealing with push buttons.