title: How can I make my source wait until button release before continuing?
body: <p>If I press button 1 it will spam my screen saying it was pressed, I want it to wait until released before it does anything else, similar to a toggle but not a toggle.</p>
  
  <p>I've tried adding a delay before, but that doesn't quite do exactly what I need... I want it to wait until released, instead of wait a hard set amount of time</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;wiringPi.h&gt;
  
  int main(void) {
      wiringPiSetupGpio();
      while(1) {
          if(!digitalRead(8) &amp;&amp; digitalRead(7)) {
              printf("Button-1 pressed\n");
          }
          if(!digitalRead(7) &amp;&amp; digitalRead(8)) {
              printf("Button-2 pressed\n");
          }
      }
      return 0;
  }
  </code></pre>
  
  <p>Expected outcome:</p>
  
  <pre><code>Button-1 pressed
  </code></pre>
  
  <p>Actual outcome:</p>
  
  <pre><code>Button-1 pressed
  Button-1 pressed
  Button-1 pressed
  Button-1 pressed
  Button-1 pressed
  Button-1 pressed
  etc...
  </code></pre>