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

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user