c#/Arduino SerialPort.read()为空
我正试图从我的arduino中检索一些数据 我在我的arduino上使用这个:c#/Arduino SerialPort.read()为空,c#,arduino,C#,Arduino,我正试图从我的arduino中检索一些数据 我在我的arduino上使用这个: Serial.println((String)animation); 这在我的c#应用程序中 log.WriteEntry(message, EventLogEntryType.Information); port.Write(message.Replace(Environment.NewLine, "")); byte[] buffer = new byte[1024]; port.Read(buffer,
Serial.println((String)animation);
这在我的c#应用程序中
log.WriteEntry(message, EventLogEntryType.Information);
port.Write(message.Replace(Environment.NewLine, ""));
byte[] buffer = new byte[1024];
port.Read(buffer, 0, buffer.Length);
message = Encoding.ASCII.GetString(buffer).Replace("\0", "");
log.WriteEntry(message, EventLogEntryType.Information);
我还使用.ReadTo(NewLine thing)进行了尝试
和.ReadLine()代码>
我的消息总是这样:不幸的是,将整数(或动画
的任何类型)转换为字符串实际上不会产生文本表示。尝试Serial.println(动画)
或Serial.println(字符串(动画))代码>不幸的是,将整数(或任何类型的动画
转换为字符串)转换为字符串实际上不会产生文本表示。尝试Serial.println(动画)
或Serial.println(字符串(动画))代码>