畫面空白處點兩下
貼這段
InitializeComponent();
if (serialPort.IsOpen)
{
serialPort.Close();
}
// Configure our serial port *** You'll likely need to change these for your config! ***
serialPort.PortName = "COM1";
serialPort.BaudRate = 115200;
serialPort.Parity = System.IO.Ports.Parity.None;
serialPort.DataBits = 8;
serialPort.StopBits = System.IO.Ports.StopBits.One;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.Ports;
namespace ConsoleApplication1
{
class Program
{
System.IO.Ports.SerialPort serialPort = new SerialPort();
public void Form1()
{
InitializeComponent();
if (serialPort.IsOpen)
{
serialPort.Close();
}
// Configure our serial port *** You'll likely need to change these for your config! ***
serialPort.PortName = "COM1";
serialPort.BaudRate = 115200;
serialPort.Parity = System.IO.Ports.Parity.None;
serialPort.DataBits = 8;
serialPort.StopBits = System.IO.Ports.StopBits.One;
}
private void InitializeComponent()
{
throw new NotImplementedException();
}