i2c_write()


Transmitting data to I2C

Description

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

Parameters

Return Value

data length (byte) on success, 0 on fail

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