title: C# asp.net /Boolean /Arduino
body: <p>Hello i have one button on webform and i would like that on first click it send "1" to arduino  on second click "0" and continusly like that, i coded it like that:</p>
  
  <pre><code>Boolean test == false;
   protected void Button3_Click(object sender, EventArgs e)
      {
  
          if (test == false)
          {
              serijska_vrata.Open();
              serijska_vrata.Write("1");
              serijska_vrata.Close();
              test = true;
          }
           if(test == true)
          {
              serijska_vrata.Open();
              serijska_vrata.Write("0");
              serijska_vrata.Close();
              test = false;
  
          } 
  
      }
  </code></pre>
  
  <p>Serijska_vrata is name of SerialPort;
  I have a felling like boolean always resets to false, and never get value "true", what can i do to repair this, please help, i`am a beginner in programming. </p>
  
  <p>Thank you for your help in advance</p>