user18905: I want to detect if a button has been pressed, but what I don't want is for it to keep returning the "pressed" state more than once within a second or two.
For example, with this code:
void loop() {
  passButtonState = digitalRead(passButton);

  if (passButtonState == LOW) {
    Serial.println("PASSED!");
  }
}

Would spit out something like this with a single quick press of the button:
PASSED!
PASSED!
PASSED!
PASSED!
PASSED!
PASSED!
PASSED!
PASSED!
PASSED!

But what I want is for a single button press to just return PASSED! once for that single button press.

user19300: If I understand the problem correctly, I think the answer might be a pretty common one. Your circuit may be suffering from "bounce" and the solution is called "debounce."
Check out this link for a possible solution:
Software Debounce

18905: <p>I want to detect if a button has been pressed, but what I don't want is for it to keep returning the "pressed" state more than once within a second or two.</p>

<p>For example, with this code:</p>

<pre class="lang-c prettyprint-override"><code>void loop() {
  passButtonState = digitalRead(passButton);

  if (passButtonState == LOW) {
    Serial.println("PASSED!");
  }
}
</code></pre>

<p>Would spit out something like this with a single quick press of the button:</p>

<pre><code>PASSED!
PASSED!
PASSED!
PASSED!
PASSED!
PASSED!
PASSED!
PASSED!
PASSED!
</code></pre>

<p>But what I want is for a single button press to just return <code>PASSED!</code> once for that single button press.</p>
 19300: <p>If I understand the problem correctly, I think the answer might be a pretty common one. Your circuit may be suffering from "bounce" and the solution is called "debounce."</p>

<p>Check out this link for a possible solution:
<a href="http://playground.arduino.cc/Learning/SoftwareDebounce" rel="nofollow">Software Debounce</a></p>
