コード例 #1
0
 static void Main(string[] args)
 {
     try
     {
         r = new SerialReaderWriter(comport: "COM4");
         r.SerialMessageReceived += r_SerialDataReceived;
         r.StartListening();
         while (true)
         {
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
コード例 #2
0
 private void btnStartListening_Click(object sender, RoutedEventArgs e)
 {
     if (listening == false)
     {
         wr.SerialMessageReceived += wr_SerialMessageReceived;
         wr.StartListening();
         listening = true;
         btnStartListening.Content = "Stop listening";
     }
     else
     {
         wr.SerialMessageReceived -= wr_SerialMessageReceived;
         wr.StopListening();
         listening = false;
         btnStartListening.Content = "Start listening";
     }
 }