I'm wondering if I can put the LED and a normally-closed momentary button together on one pin. I'm fairly new to Arduino so I'm not certain as to the best way to do this. Would I set a pin to 'digital input', then run power from the 5v pin through an LED and the momentary button into the input pin?
If you set the pin as an input, and wire it the way you indicate, the LED will only come on when the switch is pressed. In which case the Arduino won't even know anything about the LED.You can't simultaneously use a pin as input and output. One at a time, and the mode can be changed at any time. Just be careful how you wire things.
It's easier to use GPIO extensions over I2C (p.e. MCP23008). Some of them even have interrupt logic so you can build almost anything you'd do with the internal pins (OK, not truly as fast, but for a pinball more than fast enough).
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16