Let's Make Robots!

Program freezed after Wire.endTransmission();

Has anyone ever seen this problem when using WIRE library? Recently I am trying MP3 player, RTC and other device with strange issue and it all points to when I use wire library the process halt right after the line "Wire.endTransmission();"

For example:

  char len = 0;
  len = strlen(cmd);
  Serial.println("Still able to see this line...");
  Wire.endTransmission();    // stop transmitting
  Serial.println("Never gets here...");

Any clue??

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

endTransmission() will send all unsent data before closing so if there is a send error (slave not responding, bus error, ...) it may freeze with current version of the wire library.

Check this thread.

What does endTransmission() actually do?

Im not really a programmer. I think it stop transmitting action in Wire library and keep excute the next line but in my case it freezed at this line.