title: How to latch a button in C?
body: <p>When I press a button, this button performs a tast once it was pressed and even I release button, it should keep performing the task. But when I release the button, it does not perform the task.</p>
  <p>I assign a task to a button. And when I press this button and even if I release the button, I want the button to keep doing its task.</p>
  <p>Here is a part of my code:</p>
  <pre><code>   if (!input(button3)){
      buton3_state=1;
     } else buton3_state=0,buton3_lock=0;
  </code></pre>
  <pre><code>    if (buton3_state==1 &amp;&amp; buton3_lock==0)
      {   
          output_low(horn),horn_state=0;
          buton3_lock=1;
      }
  </code></pre>
  <pre><code>    if((input1_state==1 ||input2_state==1 ||input3_state==1 ||input4_state==1 ||input5_state==1 ||input6_state==1)&amp;&amp;(buton3_state==0))
  {
      horn_state=1;
  }
  if(horn_state==1){output_high(horn);}
  </code></pre>