uart_write()


Sending data to the designated UART port

Description

int uart_write(int $uart_id, string $wbuf [, int $wlen = MAX_STRING_LEN])

Parameters

Return Value

On success, the number of bytes sent is returned. otherwise: 0

Example

<?php
include "/lib/sd_340.php";
$wbuf = "abcde";
uart_setup(0, 9600);           // Configuring UART0 to 9600 bps
$slen = uart_write(0, $wbuf);  // Sending $wbuf data to UART0
usleep(500000);
echo "$slen bytes has been sent\r\n";
?>

See also