spi_write()


Transmitting data to SPI

Description

int spi_write(int $spi_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 = "\x1E\x07";
spi_setup(0);                   // configuring SPI
$slen = spi_write(0, $wbuf, 2); // transmitting data to the SPI
if($slen == 2)
  echo "$slen bytes has been sent\r\n";
?>

See also