Nefarius.Peripherals.Serial.../PInvokeSerialPort.Sample/Program.cs

16 lines
431 B
C#
Raw Normal View History

2012-03-03 10:50:54 +01:00
using System;
2022-09-30 16:33:06 +02:00
using Nefarius.Peripherals.SerialPort;
2012-03-03 10:50:54 +01:00
namespace PInvokeSerialPort.Sample
{
2022-09-30 16:33:06 +02:00
internal class Program
2012-03-03 10:50:54 +01:00
{
2022-09-30 16:33:06 +02:00
private static void Main(string[] args)
2012-03-03 10:50:54 +01:00
{
var serialPort = new SerialPort("com1", 14400);
serialPort.DataReceived += x => Console.Write((char)x);
serialPort.Open();
2022-09-30 16:33:06 +02:00
while (true) serialPort.Write(Console.ReadKey().KeyChar);
2012-03-03 10:50:54 +01:00
}
}
2022-09-30 16:33:06 +02:00
}