Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear friends,

Can I send signal to serial port of my laptop using C# code.
If yes how can I do that?

Please help with the code.

With regards bishnu
Posted
Updated 6-Nov-11 20:55pm
v2

 
Share this answer
 
You can use the SerialPort class [^]to communictae with the serial port.

Hope this helps
 
Share this answer
 
ya u can
try this

include this name space 1st

using System.IO.Ports;

then create an serial object like this
SerialPort port = new SerialPort("COM1");
even u need to know the baurd rate of the system usually it will be 9600
to write into serial port use code
port.Write("A");

hope this will help u...
 
Share this answer
 
Use the SerialPort[^] Class:

C#
SerialPort mySerialPort = new SerialPort("COM1", 9600, Parity.Odd, 8, StopBits.One);
mySerialPort.Write("a");
 
Share this answer
 

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