Receiving data form the I2C
int i2c_read(int $i2c_id, string &$rbuf, int $rlen)
data length (byte) on success
<?php
include "/lib/sd_340.php";
$rbuf = "";
$rlen = 0;
i2c_setup(0, 0x0E); // configuring I2C
while(1)
{
$rlen = i2c_read(0, $rbuf, 2); // reading 2 bytes data from the I2C
if($rlen == 2)
echo "$rbuf\r\n"; // Outputting the received data
sleep(1);
}
?>