Advertisement
Fhernd

EscrituraEnCom1.cs

Jul 20th, 2015
1,514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. // OrtizOL - xCSw - http://ortizol.blogspot.com
  2.  
  3. using System;
  4. using System.IO.Ports;
  5.  
  6. namespace Receta.CSharp.R0520
  7. {
  8.     public class EscrituraEnCom1
  9.     {
  10.         public static void Main()
  11.         {
  12.             Console.WriteLine(Environment.NewLine);
  13.            
  14.             // Creación de instancia `SerialPort`:
  15.             using( SerialPort puerto = new SerialPort("COM1"))
  16.             {
  17.                 // Propiedades del puerto COM1:
  18.                 puerto.BaudRate = 9600;
  19.                 puerto.Parity = Parity.None;
  20.                 puerto.ReadTimeout = 10;
  21.                 puerto.StopBits = StopBits.One;
  22.                
  23.                 // Escribe cadena de caracteres en el puerto:
  24.                 puerto.Open();
  25.                 puerto.Write("Blog xCSw");
  26.                
  27.                 Console.WriteLine("Se ha escrito en el puerto COM1.");
  28.             }
  29.            
  30.             Console.WriteLine(Environment.NewLine);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement