here is my problem. I use thise piece of code to send a string to my arduino with a serialport:
Arduino.Open();
Arduino.WriteLine("1.5,3.7,2");
After that I receive it with my arduino like this:
char buffer[12];
String inc;
void setup()
{
Serial.begin(115200);
}
void loop()
{
if (Serial.available() >= 11)
{
for (int i=0; i<11 ; i++)
{
buffer[i] = Serial.read();
inc += buffer[i];
}
memset(buffer, 0, sizeof(buffer));
Serial.println(inc);
inc = "";
}
}
If I use the serial monitor the arduino programm runs as intended, reads all the chars and prints them as one string. However if I try to read the string inc from my c# programm I get a format error that looks like this ".7,2????1.5".
I read the serialdata from the arduino with the command:
GlobaleVariablen.Input = Arduino.ReadLine();
The baudrate is the same, parity is set to none and stopbits on default as well. I hope you can help me, I am getting crazy over this and I just can't find my mistake or why the format is wrong.