Hi, I am reading a Chess clock (DGT3000) via I2C with a Leonardo, and my receive function looks like:
void receiveEvent(int howMany)
{
// loop through all but the last
for (int i = 0; i < howMany; i++)
{
// read byte as a character
char c = Wire.read();
Serial.print(i);
}
}
And this is working perfectly, however if I add something extra:
void receiveEvent(int howMany)
{
// loop through all but the last
for (int i = 0; i < howMany; i++)
{
// read byte as a character
char c = Wire.read();
Serial.print(i);
Serial.print(":");
Serial.print(c, HEX); // print the character
Serial.print(" ");
}
Serial.println();
}
The master (chess clock) just send 2 messages and stop sending. I am guessing this is because I am taking too much time inside the routine and conflicts between the interruption and Serial, but I actually need to output what I get via serial
What can I do?
The messages arrive twice a second, so I think there is time. Can I just tell the master to wait for me while I do Serial stuff?