Description

endTransmission() ends a transmission to a peripheral device that was begun by beginTransmission() and transmits the bytes that were queued by write().

The optional stop parameter specifies whether to release the I2C bus after transmission. If true (default), a stop message is sent, releasing the bus. If false, a restart message is sent instead, keeping the connection active. This prevents another controller device from transmitting between messages, allowing one controller to send multiple transmissions while maintaining control of the bus.

This function is part of the Wire library. See the Wire main page for more information.

Syntax

  • Wire.endTransmission()
  • Wire.endTransmission(stop)

Parameters

  • stop (optional): true sends a stop message and releases the bus after transmission. false sends a restart message, keeping the connection active. Default is true. Allowed data types: bool.

Returns

A byte value indicating the status of the transmission:

  • 0: success.
  • 1: data too long to fit in transmit buffer.
  • 2: received NACK on transmit of address.
  • 3: received NACK on transmit of data.
  • 4: other error.
  • 5: timeout.