C# – NEW 2017 – SerialPort Connection – Send/Receive through COM Ports – Putty/ Null-Modem

26
2



In this C# video tutorial I am going to show you how to send and receive data through serial ports with C#. This is my updated version of an old video.

FREE DOWNLOAD:

SerialPort Class MSDN:

Null-Modem-Emulator:

Virtual Serial Port Driver here:

Nguồn:https://wijstaanvooronzegrondrechten.org/

Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe

26 COMMENTS

  1. Thanks mate, interesting that c# looks fairly easy to work with. I'm moving from Mac to PC next week and cannot wait to mess about with c# .net

  2. using Visual Studio 2010 the receive event handler looks different. Also in 2010 I can't get the entire string being sent. Sometimes it does and sometimes i get the whole string coming from the Arduino. Why does your program work all the time and mine doesn't?

    public partial class Form1 : Form

    {

    string dataOUT;

    string sendWith;

    string dataIN;
    private void btnScan_Click(object sender, EventArgs e)

    {

    txtInput.Text = "port active";

    try

    {

    serialPort1.PortName = CBPort.Text;

    serialPort1.BaudRate = Convert.ToInt32(cbBaud.Text);

    serialPort1.DataBits = Convert.ToInt32(cbDatabits.Text);

    serialPort1.StopBits = (StopBits)Enum.Parse(typeof(StopBits), cbStopbits.Text);

    serialPort1.Parity = (Parity)Enum.Parse(typeof(Parity), cbParitybits.Text);

    serialPort1.Open();

    progressBar1.Value = 100;

    btnRed.Visible = false;

    btnGreen.Visible = true;

    serialPort1.DtrEnable = true;;

    }

    catch (Exception err)

    {

    MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

    }

    }
    private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)

    {

    dataIN = serialPort1.ReadExisting();

    this.Invoke(new EventHandler(ShowData));

    Thread.Sleep(250);

    serialPort1.DiscardInBuffer();

    }

    private void ShowData(object sender, EventArgs e)

    {

    int dataINLength = dataIN.Length;

    Thread.Sleep(500);

    txtInput.Text = dataIN;

    }

    }

  3. Hi, I am trying to read data from a scanner/scale using single cable (Magellan 8500) for my windows forms application using c#. Would you be interested in developing this for me? I am willing to pay for your this. Thanks

  4. I have been trying to build a way to interface a PC with an Arduino for months. I have read tons of stuff and tried dozens of tutorials. This is the first that has worked for me. Thank you so much. I look forward to learning more through your approach.

  5. awesome that you redid this video. Have you ever tried to achieve this with a Universal app? I am totally lost there. Would be super nice if you made a send and receive tutorial.

  6. If you are going to whisper so quietly you can't be heard, please put the text at the bottom of the screen. And thank you for not putting music in the video.

  7. Hi Kijuka

    I'm trying to do RFID program in [url removed, login to view] with serial port communication and login form using VB.net . Is there any chance you can help me out. I will appreciate it

LEAVE A REPLY

Please enter your comment!
Please enter your name here