Serial port connection


hello,

i have been given assignment connect com3 port c# application in visual studio, question is: have idea how able send line of text com3 port, , put line textbox?

the code thought usefull this:

 

serialport serp = new system.io.ports.serialport("com3", 9600, system.io.ports.parity.none, 8, system.io.ports.stopbits.one);

serp.write("test");

 

as can see, didn’t work out.

 

so appreciated.

you need open port before write it.

serialport serp = new system.io.ports.serialport("com3", 9600, system.io.ports.parity.none, 8, system.io.ports.stopbits.one);  try {   setp.open();   serp.write("test");   serp.close(); } catch {   //   // not open port !   // exist or open elsewhere ?   // }

andy





Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'