Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reading a com port

Tags:

c#

.net

I'm trying to interface with a cdc card reader which outputs to a virtual com port. How does one go about opening a stream to read from a com port?

like image 532
Jeremy Avatar asked Jul 28 '26 01:07

Jeremy


1 Answers

You can use the SerialPort from System.IO.Ports.SerialPort

It is available as a Form component in the Toolbox under Toolbox->Components->SerialPort

In the properties, you can select which COM port you want to connect to

Since your question relates to a stream object I think you can use SerialPort.BaseStream and cast it into a StreamWriter/StreamReader

like image 112
Eric Avatar answered Jul 30 '26 15:07

Eric



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!