Click here to Skip to main content
15,041,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Please help me ,
I have a problem regarding valiable calling from c # to javascript in asp.net .
how to perform real-time retrieval of Arduino uno without wifi shileld through C # then passed to the javascript that will be displayed on the web . where the transmitted data is worth " 0 " and " 1 " continuously.

for example :

Arduino code :
void setup ( ) {
  / / Initialize the digital pin as an output .
      
}

void loop ( ) {
  Serial.write ( " 1 " ) ;
  delay (1000 ) ;
 Serial.write ( " 0 " ) ;
  delay (1000 ) ;
}


C # Code
 public String msg ;
 public void DataReceivedHandler ( object sender , SerialDataReceivedEventArgs e ) {
            SerialPort sp = ( SerialPort ) sender ;
            indata string = sp.ReadExisting ( ) ;

            msg = indata ;

           
        }

Javascript code
 SaySomethingToUnity function ( ) {
                 a = < % = msg % >
                 alert ( a) ;
                 u.getUnity ( ) . SendMessage ( " Main Camera " , " note_c " , a) ;
                      
             }
Posted
Comments
Member 13682845 17-Feb-18 9:39am
   
I want ans

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900