I successfully get the data from the slave. Then directly after the loop i print out the data and then i get funny characters at the end. Can some one explain to me what these characters are and why are they random values?
this is the code i use to read the data that the slave return.
void requestData(){
Serial.println("Request Returning");
//clean the array
for(int i =0;i<32;i++)
{
data[i]=' ';
}
delay(10);
if (Wire.requestFrom(slaveId,25))
{
int i =0;
while (Wire.available())
{
char c;
c=Wire.read();
if(c>0x1F && c<0x7F)
{
Serial.println(c);
data[i] =c;
}
i++;
}
Serial.println(data); //This is the line that i am getting the funny characters on. See image link below
}
else
{
Serial.println("Unable to");
Serial.println("Retrieve the data requested");
}
}