Wire.endTransmission()

[Wire]

描述

Ends a transmission to a slave device that was begun by beginTransmission() and transmits the bytes that were queued by write().

endTransmission() accepts a boolean argument (stop) 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.

語法

Wire.endTransmission()
Wire.endTransmission(stop)

參數

stop: boolean. true will send a stop message, releasing the bus after transmission. false will send a restart, keeping the connection active.

回傳

byte, which indicates 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

參考


函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール