26 lines
488 B
C#
Executable File
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();
|
|
}
|
|
} |