title: Send data from Arduino to asp.net
body: <p>I have a problem regarding variable calling from C# to javascript in asp.net:
  how to perform real-time retrieval of Arduino uno without wifi shield through C#, then passed to the javascript that will be displayed on the web, where the transmitted data equals 0 and 1 continuously.</p>
  
  <p><strong>Example</strong></p>
  
  <p>Arduino code:</p>
  
  <pre><code>void setup ( ) {
    / / Initialize the digital pin as an output .
  
  }
  
  void loop ( ) {
    Serial.write ( " 1 " ) ;
    delay (1000 ) ;
   Serial.write ( " 0 " ) ;
    delay (1000 ) ;
  }
  </code></pre>
  
  <p>C# Code:</p>
  
  <pre><code>public String msg ;
  public void DataReceivedHandler ( object sender , SerialDataReceivedEventArgs e ) {
      SerialPort sp = ( SerialPort ) sender ;
      indata string = sp.ReadExisting ( ) ;
      msg = indata ;
  }
  </code></pre>
  
  <p>Javascript code:</p>
  
  <pre><code>SaySomethingToUnity function ( ) {
      a = &lt; % = msg % &gt;
      alert ( a) ;
      u.getUnity ( ) . SendMessage ( " Main Camera " , " note_c " , a) ;
  }
  </code></pre>