user3299: I use the Pin 7 to get the status of a push button. I put 10Kohm R on the - .
The status is unstable because arduino says thet I push it but it is not true...
int button = 7;
...
// var for reading pushbutton value
int buttonState = 0;
...
buttonState = digitalRead(button);
  if(buttonState == HIGH)
  {
    myFunction();
  }

EDIT :
ARDUINO PIN 7 <---> R 10Kohm <--> [switch] <---> VCC

user2967: Note that you can also activate the internal pull-up resistor on the pin by first making it an input, then setting it to HIGH.
pinMode(pin, INPUT);
digitalWrite(pin, HIGH);

EDIT:
Based on info from Craig (in the comments below) it's simpler to use the new pinMode INPUT_PULLUP:
pinMode(pin, INPUT_PULLUP);

Then wire the switch directly to ground. 
This is the simplest way to wire a pushbutton to an arduino (no resistor needed) but do you need an extra line of code. 
Also, the pin will read as HIGH when not pressed, and LOW when pressed (which might seem counter-intuitive)

user42: At the moment, your resistor isn't doing anything useful. When your switch is open, the pin is still 'floating', which means it's ending up with random stray readings from nearby electromagnetic fields.
You basically need two connections coming from your Arduino pin. One goes through a resistor straight to ground. The other goes through your switch straight to +5V.
In that case, the resistor is acting as a pull-down, because it holds your pin at Ground whenever the switch is open. You could swap over the ground and +5V, and it the resistor would function as a pull-up instead.
This question deals with the same kind of issue:

Button state changing randomly


3299: <p>I use the Pin 7 to get the status of a push button. I put 10Kohm R on the - .</p>

<p>The status is unstable because arduino says thet I push it but it is not true...</p>

<pre><code>int button = 7;
...
// var for reading pushbutton value
int buttonState = 0;
...
buttonState = digitalRead(button);
  if(buttonState == HIGH)
  {
    myFunction();
  }
</code></pre>

<p><strong>EDIT :</strong></p>

<p>ARDUINO PIN 7 &lt;---> R 10Kohm &lt;--> [switch] &lt;---> VCC</p>
 2967: <p>Note that you can also activate the internal pull-up resistor on the pin by first making it an input, then setting it to HIGH.</p>

<pre><code>pinMode(pin, INPUT);
digitalWrite(pin, HIGH);
</code></pre>

<h3>EDIT:</h3>

<p>Based on info from Craig (in the comments below) it's simpler to use the new pinMode INPUT_PULLUP:</p>

<pre><code>pinMode(pin, INPUT_PULLUP);
</code></pre>

<p>Then wire the switch directly to ground. </p>

<p>This is the simplest way to wire a pushbutton to an arduino (no resistor needed) but <strong>do</strong> you need an extra line of code. </p>

<p>Also, the pin will read as HIGH when not pressed, and LOW when pressed (which might seem counter-intuitive)</p>
 42: <p>At the moment, your resistor isn't doing anything useful. When your switch is open, the pin is still 'floating', which means it's ending up with random stray readings from nearby electromagnetic fields.</p>

<p>You basically need two connections coming from your Arduino pin. One goes through a resistor straight to ground. The other goes through your switch straight to +5V.</p>

<p>In that case, the resistor is acting as a pull-down, because it holds your pin at Ground whenever the switch is open. You could swap over the ground and +5V, and it the resistor would function as a pull-up instead.</p>

<p>This question deals with the same kind of issue:</p>

<ul>
<li><a href="https://arduino.stackexchange.com/questions/186/button-state-changing-randomly/187">Button state changing randomly</a></li>
</ul>
