i2c_write()


向I2C传送数据

Description

int i2c_write(int $i2c_id, int/string $wbuf[, int $wlen = MAX_STRING_LEN])

Parameters

Return Value

成功时传送数据长度(byte),失败时0

Example

<?php
include "/lib/sd_340.php";
$wbuf = "\x05\x03";
i2c_setup(0, 0x1e);                // configuring I2C
$slen = i2c_write(0, $wbuf, 2);    // transmitting data to the I2C
if($slen == 2)
  echo "$slen bytes have been sent\r\n";
?>

See also