Created
July 21, 2015 04:06
-
-
Save Fhernd/c04425a3b177c0ad4d92 to your computer and use it in GitHub Desktop.
Escritura sobre puerto serial COM1 en C#.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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