Im making some tests using LabView, its really easy to interface with it, but a have some problems:
If i send from labview and a dial (0-255) valors, the problem is that it will be send one character at the time.... how can i receive a string of more than 2 characters in the serial port?
i try this:
a = Serial.read();
b = Serial.read();
c = Serial.read();
Serial.print("Se recibio: ");
Serial.print(a);
Serial.print(b);
Serial.println(c);
For receiving 3 characters, but i only get this on the monitor:
you must check to see if characters are available for reading (with Serial.available()). Otherwise, Serial.read() will return garbage (which is exactly what you are seeing).
e.g.
while (Serial.available() < 1 )
{;}
a=Serial.read();
while (Serial.available() < 1 )
{;}
b=Serial.read();
...