SoftwareSerial read data incorrectly.


I’m using Arduino Duemilanove to receive serial communication wirelessly, when I send “test” to PC the terminal prints “test”.

When I send “test” from PC, the serial on the Arduino side prints “F4E5F3F4” as it suppose to be “74657374”.

Has anyone experienced this problem and can give me some advise?

Thank you.

void loop()
  while (mySerial.available()) {
      incomingByte =;
      str += incomingByte;
    if (str.length() >0) {
      for(int i=0;i<str.length();i++){

void myPtHex(int g){
  int a = g& 0xf0;
  a = a >> 4;
  int b = g& 0x0f;
  char c = a < 10 ? a + '0' : a + 'A' - 10;
  c = b < 10 ? b + '0' : b + 'A' - 10;
} // myPtHex

Maybe the PC is sending the wrong stuff. The Arduino code looks reasonable - though I have not studied your HEX function. Just print it is decimal or chars in case the problem is with your function.

Can't you use Serial.print(var, HEX); to do the conversion?


Hi Robin2,

Thanks, I've tried the conversion you suggested:

if (mySerial.available())

Still not receiving the correct data, still getting "F4E5F3F4".

Is the sending device sending 7 bit data with parity? Given the data, it doesn't look likely, but worth checking.

sec33567: Still not receiving the correct data, still getting "F4E5F3F4".

Then it sounds like the problem is with the PC - or a mismatch between the PC and the Arduino.