C:\> Rostislav Persion's Projects

.:: Arduino C# Serial Com ::.
Communicating with Arduino using C#




This is a very simple C# console application that reads serial data from an Arduino using USB serial communication.

SOFTWARE WRITTEN IN C#
   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Text;
   5:  using System.Threading.Tasks;
   6:  using System.IO.Ports;
   7:  using System.Threading;
   8:   
   9:  namespace Serial1
  10:  {
  11:      class Program
  12:      {
  13:          static void Main(string[] args)
  14:          {
  15:              SerialPort sp1 = new SerialPort("COM4", 9600);
  16:              sp1.Open();
  17:   
  18:              while(true)
  19:              {
  20:   
  21:                  string val = sp1.ReadLine();
  22:                  Console.WriteLine(val);
  23:   
  24:              }
  25:   
  26:              sp1.Close();
  27:   
  28:   
  29:          }
  30:      }
  31:  }