我正在用 C# 学习 AT 命令。
public static void Main(string[] args)
{
String command = "AT";
SerialPort serialPort = new SerialPort
{
PortName = "COM4",
BaudRate = 9600,
DataBits = 8,
Parity = Parity.None,
ReadTimeout = 300,
WriteTimeout = 300,
StopBits = StopBits.One,
Handshake = Handshake.None
};
serialPort.Open();
serialPort.WriteLine(command + "\r");
String outPut = serialPort.ReadExisting();
Console.WriteLine(outPut);
}
我确定PortName。我在程序中做错了什么?
提前致谢 :)