Nefarius.Peripherals.Serial.../PInvokeSerialPort.Sample/Program.cs
2024-07-14 10:57:12 +02:00

26 lines
488 B
C#
Executable File

using System;
using Nefarius.Peripherals.SerialPort;
namespace PInvokeSerialPort.Sample;
internal class Program
{
private static void Main(string[] args)
{
SerialPort serialPort = new SerialPort("com5") { UseRts = HsOutput.Online };
serialPort.DataReceived += x =>
{
Console.Write($"{x:X2} ");
};
serialPort.Open();
serialPort.Write("START\r\n");
Console.ReadKey();
serialPort.Close();
}
}