Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created July 21, 2015 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/c04425a3b177c0ad4d92 to your computer and use it in GitHub Desktop.
Save Fhernd/c04425a3b177c0ad4d92 to your computer and use it in GitHub Desktop.
Escritura sobre puerto serial COM1 en C#.
// OrtizOL - xCSw - http://ortizol.blogspot.com
using System;
using System.IO.Ports;
namespace Receta.CSharp.R0520
{
public class EscrituraEnCom1
{
public static void Main()
{
Console.WriteLine(Environment.NewLine);
// Creación de instancia `SerialPort`:
using( SerialPort puerto = new SerialPort("COM1"))
{
// Propiedades del puerto COM1:
puerto.BaudRate = 9600;
puerto.Parity = Parity.None;
puerto.ReadTimeout = 10;
puerto.StopBits = StopBits.One;
// Escribe cadena de caracteres en el puerto:
puerto.Open();
puerto.Write("Blog xCSw");
Console.WriteLine("Se ha escrito en el puerto COM1.");
}
Console.WriteLine(Environment.NewLine);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment