0
私はシリアルポート経由でarduinoからC#を使って文字列を読んでいます。 想定されるアクションを実行すると、文字列がテキストボックスに表示されます。 私が今必要とするのは、それらを配列に入れてcsvまたはxlsファイルに格納することです。VSでarduinoから文字列を受け取ると、どうやってcsvまたはxlsファイルに保存できますか?
private void btRecOn_Click(object sender, EventArgs e)
{
if (serialPort1.IsOpen == true) // COMport is open
Text = recon; // string recon = "recording on"
serialPort1.Write(Text); // sends text "recording on" to arduino
}
private void SerialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
RxString = serialPort1.ReadExisting(); // reads data from serial port
this.Invoke(new EventHandler(trataDadoRecebido)); // calls another thread to write data in text
}
private void trataDadoRecebido(object sender, EventArgs e)
{
textBoxReceber.AppendText(RxString);
}
私の目標は、「保存」ボタンを押すことで、それらの文字列は、CSVまたはXLSファイルの別の行に保存され。 私は既にinteropを試しましたが、面倒です!あなたの意見にはどのような方法がありますか?
私にいくつかの助けやヒントを教えてください。
ありがとうございます。
ありがとう、それは私の問題を解決! –