Hello Everybody,
I'm trying to save the information from 6 different Textbox in VB.Net application to the SD card in .txt.
I can save the file with the next code,
ARDUINO CODE
if (Serial.available() > 0) {
int inCharx = Serial.read();
if (isDigit(inCharx)) {
inStringx += (char)inCharx;
pl1 =(inStringx.toInt());
SD.remove("plan.txt");
myFilep = SD.open("plan.txt",FILE_WRITE);
if (myFilep) {
myFilep.println(inStringx);
myFilep.println();
myFilep.close();
} else {
Serial.println("error opening plan.txt");
}
}
}
VB.NET CODE
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
selPort = ComboBox1.Text
SPSetup()
'System.Threading.Thread.Sleep(1000)
If SerialPort.IsOpen Then
'SerialPort.Write(Chr(1) & Chr(90) & Chr(48) & Chr(57) & Chr(48)) 'txtSendData.Text)
SerialPort.WriteLine(TextBox1.Text)
SerialPort.WriteLine("\CR")
SerialPort.WriteLine(TextBox2.Text)
SerialPort.WriteLine("\CR")
SerialPort.WriteLine(TextBox3.Text)
SerialPort.WriteLine("\CR")
SerialPort.WriteLine(TextBox4.Text)
SerialPort.WriteLine("\CR")
SerialPort.WriteLine(TextBox5.Text)
SerialPort.WriteLine("\CR")
SerialPort.WriteLine(TextBox6.Text)
SerialPort.WriteLine("\CR")
End If
SerialPort.Close()
End Sub
But the result is all the textbox in one line.
I'm already make the test with coma "," "\r" instead of "\CR" but the result is the same.
Also, I tried to do the same saving in .csv file but the result is the same.
What I'm trying to do is writing new parameters from VB.Net and saving in the SD of arduino,
In case of power off, the arduino can load the same parameters previously saved at startup.
This different textbox must be in different variables in arduino code. But firs, I need to saved with some separation between.
I really appreciate any help with this topic. Maybe it's something about conversion of values, but for the moment I'm lost.
Thanks in advance!
RG