Hi,
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()) {
delay(2);
incomingByte = mySerial.read();
str += incomingByte;
}
if (str.length() >0) {
for(int i=0;i<str.length();i++){
myPtHex(str[i]);
}
str="";
}
}
void myPtHex(int g){
int a = g& 0xf0;
a = a >> 4;
int b = g& 0x0f;
char c = a < 10 ? a + '0' : a + 'A' - 10;
Serial.write(c);
c = b < 10 ? b + '0' : b + 'A' - 10;
Serial.write(c);
} // myPtHex