Wire.endTransmission();

How do I know whether this function returns a TRUE or FALSE?

As of Arduino 1.0.1, endTransmission() accepts a boolean argument changing its behavior for compatibility with certain I2C devices.

If true, endTransmission() sends a stop message after transmission, releasing the I2C bus.

If false, endTransmission() sends a restart message after transmission. The bus will not be released, which prevents another master device from transmitting between messages. This allows one master device to send multiple transmissions while in control.

The default value is true.

I'm using it in this piece of code from the Li Power Shield example code. I imagine that only 1 line of code using Wire.write(); is necessary, right?

/************************************************************************
5. i2cWrite16(unsigned int data, unsigned char address) writes 16 bits
   of data beginning at an 8-bit address, and continuing to the next.
************************************************************************/
void i2cWrite16(unsigned int data, unsigned char address)
{

  Wire.beginTransmission(MAX17043_ADDRESS);
  Wire.write(address);
  //Wire.write((byte)((data >> 8) & 0x00FF));                 
  //Wire.write((byte)(data & 0x00FF));
  Wire.endTransmission();
}

How do I know whether this function returns a TRUE or FALSE?

The optional argument has nothing to do with whether the function returns true or false. The documentation is talking about what endTransmission(true); does that is different from what endTransmission(false); does.

I imagine that only 1 line of code using Wire.write(); is necessary, right?

Is it address or data that you want to send? Doesn't the I2C device you are talking to know it's address? If not, how does it know you are talking to it?

If it does know it's address, what use is it sending the low order byte of the address to it?

PaulS:

I imagine that only 1 line of code using Wire.write(); is necessary, right?

Is it address or data that you want to send? Doesn't the I2C device you are talking to know it's address? If not, how does it know you are talking to it?

If it does know it's address, what use is it sending the low order byte of the address to it?

I believe it is both data and address I want to send. I did not create this function, but its purpose is to Configure the MAX17043's alert percentage. I understand the Li Power shield to be the Master and the Arduino Uno R3 to be the slave. I don't know if the i2c device I'm talking to knows its address. How do I find out? I assume the i2c device that I'm talking to is the Arduino Uno R3.

I'm calling this function with this data - i2cWrite16(0x9700, 0x0C);

BatteryShield_lcd.ino (8.09 KB)