I have a question.
Is there a way to put a led and a button together on a digital I/O pin?
So that i can sometimes get the led light up.
And sometimes readout the button?
something like the led/button used in the following project : http://youtu.be/IY6y4dY0lQU
You see there only goes 2 wires to the breadboard with the led and the button on it.
No, you cannot make them independent. You can't have a button and an LED act independently with only one wire.
If you've only got two wires, total, pressing the button will do something to the LED, no matter how you wire it.
I don't view video, so I can't comment on what they did in the video. Could they have 2 wires plus ground? That would let them use two pins like people normally do.
something like the led/button used in the following project
What they did was nothing like you are asking about. The LED is directly wired across the button, so pressing the button shorts out the LED.
See this project for the reverse, that is lighting an LED when a switch contact is made.
The I/O pin alternates between being used as an input (sensing button presses) and an output (lighting LED). It's not used as both an input and an output at the same time.
The video shows the LED is used to indicate when button presses are accepted or not. The LED flashes always occur after the button presses are finished. There's likely some minimum allowed time between button presses. Once this time has elapsed the I/O pin switches to output (LED) mode.
That is what is mean.
A led responce after a good button press.
But with two wires only.
So the led and the button use the same I/O pin.
How can i program and wire that right?