[Wire]
説明
Used by the master to request bytes from a slave device. The bytes may then be retrieved with the available() . read() functions.
requestFrom()
accepts a boolean argument (stop
) changing its behavior for compatibility with certain I2C devices. If true, requestFrom()
sends a stop message after the request, releasing the I2C bus. If false, requestFrom()
sends a restart message after the request. The bus will not be released, which prevents another master device from requesting between messages. This allows one master device to send multiple requests while in control. The default value is true.
構文
Wire.requestFrom(address, quantity) Wire.requestFrom(address, quantity, stop)
媒介変数
address
: the 7-bit address of the device to request bytes fromquantity
: the number of bytes to requeststop
: boolean. true will send a stop message after the request, releasing the bus. false will continually send a restart after the request, keeping the connection active.
戻り値
byte: the number of bytes returned from the slave device
See also
Libraries Reference Home
86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。