If I send the text "12345678" with the command Wire.Write it's received as "123456756"
The last character is always converted to it's decimal equilant.
I can't figure out why it's doing this.
It doesn't matter how long the string is.
Why does it do that and how can I make it show the character?
void receiveEvent(int howMany)
{
while(1 < Wire.available()) // loop through all but the last
{
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
}
int x = Wire.read(); // receive byte as an integer
Serial.println(x); // print the integer
}
Just copied sample code from arduino.cc, didn't read the code...
Nothing wrong with the codes. The author has read the first seven bytes and presented their ASCII forms on the Serial Monitor. So, it appeared as 1234567. The last byte (which has arrived as 0x38) has been displayed in decimal-base, and it has appeared as 56 on the Serial Monitor.