Serial Port Communication
:WAVE: everyone (I'm new to the forum)
I've written a program to retreive data from a badge system via serial port.
The problem is that the data I receive is in some sort of code, I believe it is ANSI but I'm not sure.
Here's the input I get:
]À&DUÃ
Normally this code must contain at least the following (human readable):
28633 (this is the id of my badge)
Here's my code for input:
-------------------------------------------------------------------------
StringBuffer inputBuffer = new StringBuffer();
int newData = 0;
while (input.available() > 0)
{
newData = input.read();
if (newData == -1)
{
break;
}
if ('\r' == (char)newData)
{
inputBuffer.append('\n');
}
else
{
inputBuffer.append((char)newData);
}
System.out.println(new String(inputBuffer));
-------------------------------------------------------------------------
Does anyone know how I can handle this?
thx in advance